Using a custom php.ini when using FAST CGI (fcgi) in Cpanel WHM

When using FastCGI (FCGI) as the loader for PHP, traditional php_values in the .htaccess file as well as custom php.ini files in the public_html directory no longer work. Instead we must create a wrapper for the main FCGI binary that causes the php.ini to be loaded from it’s current working directory instead of the server-wide one.

Edit the .htaccess file in the directory you want to use a custom PHP configuration for and add the following lines to the bottom of the file:

AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php5.fcgi

Next, you’ll need to copy your your main server php.ini which is located in /usr/local/lib/. Also note that it needs to have the correct ownership.

cd /home/user/public_html/cgi-bin/
cp -a /usr/local/lib/php.ini .
chown user:user php.ini
chgrp user:user php.ini

Create a file in your current directory (cgi-bin) called  php5.fcgi as defined above and add the following:

#!/bin/sh
export PHP_FCGI_CHILDREN=1
export PHP_FCGI_MAX_REQUESTS=10
exec /usr/local/cpanel/cgi-sys/php5

Finally, make sure the ownership and permissions are correct on this file:

chown user:user php5.fcgi && chmod 0755 php5.fcgi
chgrp user:user php5.fcgi && chmod 0755 php5.fcgi

You can now edit the php.ini inside cgi-bin/ and change the desired values. You can verify they are set properly by inserting the phpinfo() function inside a PHPscript on that user account.


NEC 2SB706A Power Transistors, NOS, Unused, Guaranteed picture

NEC 2SB706A Power Transistors, NOS, Unused, Guaranteed

$45.00



1PC Pepperl+Fuchs UC2000-30GM-IUR2-V15 Ultrasonic Barrel-Style Proximity Sensor picture

1PC Pepperl+Fuchs UC2000-30GM-IUR2-V15 Ultrasonic Barrel-Style Proximity Sensor

$290.00



Thermoelectric Cooler Peltier System Semiconductor Water Chiller Aquarium 180W picture

Thermoelectric Cooler Peltier System Semiconductor Water Chiller Aquarium 180W

$36.34



Peak, Atlas DCA55 Semiconductor Tester picture

Peak, Atlas DCA55 Semiconductor Tester

$112.95



Donovan Industries 1560-1F Leadframe Bonder Semiconductor Thermal Bonding Press picture

Donovan Industries 1560-1F Leadframe Bonder Semiconductor Thermal Bonding Press

$3999.00



10 PCS 2N2369 National Semiconductor NPN Gold colored Transistor 40V 0.2A TO-18 picture

10 PCS 2N2369 National Semiconductor NPN Gold colored Transistor 40V 0.2A TO-18

$12.90



New American Semiconductor Power Stud Diode Rectifier - 85HF40 - 85A400V - 4 pcs picture

New American Semiconductor Power Stud Diode Rectifier - 85HF40 - 85A400V - 4 pcs

$20.00



National Semiconductor MM74HC4040N Binary Counter IC DIP-16 Vintage picture

National Semiconductor MM74HC4040N Binary Counter IC DIP-16 Vintage

$9.99



Gas Leak Detector Propane & Natural Gas Detector Visual & Audio Alarm Metal Prob picture

Gas Leak Detector Propane & Natural Gas Detector Visual & Audio Alarm Metal Prob

$17.50



ADVANCED ENERGY PINNACLE PLUS 10kW SINGLE INVERTER 208V 3P + 3152533-348 D picture

ADVANCED ENERGY PINNACLE PLUS 10kW SINGLE INVERTER 208V 3P + 3152533-348 D

$3499.99



Powered by WordPress. Designed by WooThemes