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.


Brand New STMicroelectronics M4T28-BR12SH1 TIMEKEEPER SNAPHAT Battery picture

Brand New STMicroelectronics M4T28-BR12SH1 TIMEKEEPER SNAPHAT Battery

$16.49



PM50CLS120 MITSUBISHI ELECTRIC IGBT-MODUL ID191791 Spot Goods Ups Express #CG picture

PM50CLS120 MITSUBISHI ELECTRIC IGBT-MODUL ID191791 Spot Goods Ups Express #CG

$313.40



Fuji IGTB Unit A50L-0001-0327 picture

Fuji IGTB Unit A50L-0001-0327

$29.95



200pcs TO-92 10 Values NPN PNP BC327 2N2907 2N3906 S8050 C1815 Transistor picture

200pcs TO-92 10 Values NPN PNP BC327 2N2907 2N3906 S8050 C1815 Transistor

$11.99



TO-92 Assortment NPN PNP DIY kit 15 value 600pcs Transistor  picture

TO-92 Assortment NPN PNP DIY kit 15 value 600pcs Transistor

$11.52



25pcs 2N2222 (2N2222A?) NPN General Purpose Transistor TO-92 - GENERIC/UNBRANDED picture

25pcs 2N2222 (2N2222A?) NPN General Purpose Transistor TO-92 - GENERIC/UNBRANDED

$2.39



100pcs 2n3904 General Purpose NPN Transistor TO-92 SOLD/SHIP USA  picture

100pcs 2n3904 General Purpose NPN Transistor TO-92 SOLD/SHIP USA

$5.55



840PCS 24 Value TO-92 Transistor Assortment Kit Box NPN PNP 2N2222-S9018 / BC327 picture

840PCS 24 Value TO-92 Transistor Assortment Kit Box NPN PNP 2N2222-S9018 / BC327

$14.99



2N2905A Series PNP 60 V 600 mA 0.6 W ThrUHole Switching Transistor - TO-39-3 5PC picture

2N2905A Series PNP 60 V 600 mA 0.6 W ThrUHole Switching Transistor - TO-39-3 5PC

$11.99



10pcs TIP36C TIP36 Power Transistor 25A 100V PNP bipolar to-247 USA picture

10pcs TIP36C TIP36 Power Transistor 25A 100V PNP bipolar to-247 USA

$11.94



Powered by WordPress. Designed by WooThemes