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.


Used & Tested IPC PCI-6870F Motherboard picture

Used & Tested IPC PCI-6870F Motherboard

$255.11



Used & Tested IEI SSC-5X86HVGA REV.1.8 Industrial Motherboard       picture

Used & Tested IEI SSC-5X86HVGA REV.1.8 Industrial Motherboard

$299.18



Used & Tested ADVANTECH PCI-7030VG PCI Motherboard picture

Used & Tested ADVANTECH PCI-7030VG PCI Motherboard

$328.44



Used & Tested 5366271-2 Motherboard picture

Used & Tested 5366271-2 Motherboard

$819.84



Onity Motherboard picture

Onity Motherboard

$20.00



ALL Original XBOX V1.0 V1.2 V 1.3 - V1.5 V1.6 Motherboard Capacitor Upgrade kit picture

ALL Original XBOX V1.0 V1.2 V 1.3 - V1.5 V1.6 Motherboard Capacitor Upgrade kit

$13.99



IEI wafer PV-D5253-R10 SBC single board computer windows 7 embedded picture

IEI wafer PV-D5253-R10 SBC single board computer windows 7 embedded

$44.00



25 10x12

25 10x12" Open-Top Dou Yee Static Shield Bags

$6.18



Used & Tested IB940-R Industrial Computer Motherboard picture

Used & Tested IB940-R Industrial Computer Motherboard

$244.49



New In Box LPQ113 Motherboard picture

New In Box LPQ113 Motherboard

$1088.83



Powered by WordPress. Designed by WooThemes