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 GIGABYTE GA-6BXC REV2.0 Motherboard picture

Used & Tested GIGABYTE GA-6BXC REV2.0 Motherboard

$163.11



Used & Tested AXIOMTEK IMB200 Motherboard picture

Used & Tested AXIOMTEK IMB200 Motherboard

$487.56



Used & Tested DFI EL630 EL630-NR Industrial Computer Motherboard picture

Used & Tested DFI EL630 EL630-NR Industrial Computer Motherboard

$475.97



KUKA Motherboard Super 370SBA / 370 SBA picture

KUKA Motherboard Super 370SBA / 370 SBA

$869.96



Advantech PCA-6194 REV.A1  industrial motherboard PCA-6194G2 picture

Advantech PCA-6194 REV.A1 industrial motherboard PCA-6194G2

$187.99



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

$15.99



NEW ASUS TX GAMING B850M WiFi S Miku AM5 DDR5 Motherboard Fast delivery picture

NEW ASUS TX GAMING B850M WiFi S Miku AM5 DDR5 Motherboard Fast delivery

$405.00



1PCS NEW MAXSUN iCraft B860M CROSS Pro DDR5 Motherboard Fast delivery picture

1PCS NEW MAXSUN iCraft B860M CROSS Pro DDR5 Motherboard Fast delivery

$350.00



New In Box ASUS P8B-E/4L Motherboard     picture

New In Box ASUS P8B-E/4L Motherboard

$178.65



New In Box ADLINK PCIE-GIE74 Motherboard picture

New In Box ADLINK PCIE-GIE74 Motherboard

$430.43



Powered by WordPress. Designed by WooThemes