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.


Toggle SWITCH ON/OFF Heavy Duty 15A 250V SPST2 Terminal Car Boat Waterproof 5pcs picture

Toggle SWITCH ON/OFF Heavy Duty 15A 250V SPST2 Terminal Car Boat Waterproof 5pcs

$6.99



5pcs 15A 250V SPST2 Toggle SWITCH ON/OFF Heavy Duty Terminal Car Boat Waterproof picture

5pcs 15A 250V SPST2 Toggle SWITCH ON/OFF Heavy Duty Terminal Car Boat Waterproof

$7.99



New Square D Pressure Switch 9013FHG42J59X 135-175 PSI w/ Unloader Port 1/4

New Square D Pressure Switch 9013FHG42J59X 135-175 PSI w/ Unloader Port 1/4" NPT

$59.95



The Original EZ GENERATOR TRANSFER SWITCH - UL / CSA Approved - USA Made - 12OV picture

The Original EZ GENERATOR TRANSFER SWITCH - UL / CSA Approved - USA Made - 12OV

$95.99



Push Button 12/16/19/22mm Momentary Switch Waterproof Car Boat Led Light switchs picture

Push Button 12/16/19/22mm Momentary Switch Waterproof Car Boat Led Light switchs

$5.99



5 Gang Toggle Rocker Switch Panel For Car Boat Marine RV Truck Blue LED 12V picture

5 Gang Toggle Rocker Switch Panel For Car Boat Marine RV Truck Blue LED 12V

$10.59



5Pin Automotive Car Relay Switch SPDT Harness Socket Waterproof 40A DC 12V 12AWG picture

5Pin Automotive Car Relay Switch SPDT Harness Socket Waterproof 40A DC 12V 12AWG

$11.99



Custom Metal Push Button Switch Start Stop LED Light For Car Fog Switch 12V 24V picture

Custom Metal Push Button Switch Start Stop LED Light For Car Fog Switch 12V 24V

$17.99



5pcs 12V 4

5pcs 12V 4" Wire Leads Waterproof On-Off Push-Button Switch for Motorcycle Car

$8.98



3Pcs 12V 30A Blue LED Light Toggle Rocker ON/OFF Switch 3Pin Marine Car Boat ATV picture

3Pcs 12V 30A Blue LED Light Toggle Rocker ON/OFF Switch 3Pin Marine Car Boat ATV

$9.99



Powered by WordPress. Designed by WooThemes