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.


TOA Electric Co. Type ZM-104 X1 X10 X100 Speaker Impedance Meter picture

TOA Electric Co. Type ZM-104 X1 X10 X100 Speaker Impedance Meter

$124.99



Nuvasive Electrode Impedance Meter picture

Nuvasive Electrode Impedance Meter

$70.00



Fischer CISPR 22 Impedance Stabilization Network 9 kHz - 30 MHz FCC-TLISN-T4 picture

Fischer CISPR 22 Impedance Stabilization Network 9 kHz - 30 MHz FCC-TLISN-T4

$549.00



Gold Line ZM-1P Impedance Meter with Protection Relay picture

Gold Line ZM-1P Impedance Meter with Protection Relay

$648.98



LCR45 Passive Component Impedance Analyser PEAK Atlas LCR 45 picture

LCR45 Passive Component Impedance Analyser PEAK Atlas LCR 45

$136.94



TOA ZM-104A Impedance Meter Measures Impedance Of Speaker Lines Up To 100k Ohms picture

TOA ZM-104A Impedance Meter Measures Impedance Of Speaker Lines Up To 100k Ohms

$251.50



Goldline ZM1P Impedance Meter with Overload Protection picture

Goldline ZM1P Impedance Meter with Overload Protection

$673.33



Goldline ZM1-GOLDLINE Impedance Meter picture

Goldline ZM1-GOLDLINE Impedance Meter

$420.00



4090 Digital LCR Meter 10-100Khz Desktop Capacitance Resistance Impedance Ind... picture

4090 Digital LCR Meter 10-100Khz Desktop Capacitance Resistance Impedance Ind...

$429.50



Gold Line ZM-1 Impedance Meter picture

Gold Line ZM-1 Impedance Meter

$559.98



Powered by WordPress. Designed by WooThemes