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.


Q2100 SIEMENS PLUG-IN CIRCUIT BREAKER 2 POLE 100 AMP 120 VAC NEW picture

Q2100 SIEMENS PLUG-IN CIRCUIT BREAKER 2 POLE 100 AMP 120 VAC NEW

$34.94



Pack Of 10 Arc Fault Breaker 20 A Siemens QA120AFCN Plug-On Neutral picture

Pack Of 10 Arc Fault Breaker 20 A Siemens QA120AFCN Plug-On Neutral

$325.00



SIEMENS QA120AFC 20AMP 1-POLE TYPE QAF2 FAULT CIRCUIT INTERRUPTER  picture

SIEMENS QA120AFC 20AMP 1-POLE TYPE QAF2 FAULT CIRCUIT INTERRUPTER

$29.00



Siemens W0408L1125SPA60 60 Amp Spa Panel Gfci Breaker 2-Pole 240v Outdoor Box picture

Siemens W0408L1125SPA60 60 Amp Spa Panel Gfci Breaker 2-Pole 240v Outdoor Box

$233.61



LOT OF 5 NEW SIEMENS 15 AMP COMBINATION AFCI CIRCUIT BREAKER 120 VAC QA115AFCN picture

LOT OF 5 NEW SIEMENS 15 AMP COMBINATION AFCI CIRCUIT BREAKER 120 VAC QA115AFCN

$134.99



Siemens Q120DF Dual Function AFCI/GFCI Circuit Breaker 120VAC 20A QFGA2 picture

Siemens Q120DF Dual Function AFCI/GFCI Circuit Breaker 120VAC 20A QFGA2

$44.88



Siemens QF220A 2 pole 20 Amp 120V Ground Fault Circuit Interrupter NEW picture

Siemens QF220A 2 pole 20 Amp 120V Ground Fault Circuit Interrupter NEW

$118.99



SIEMEN'S 100AMP 2POLE  CIRCUIT BREAKER    TYPE QPH   Q2100H   picture

SIEMEN'S 100AMP 2POLE CIRCUIT BREAKER TYPE QPH Q2100H

$25.95



1PC SIEMENS Q120DFN Q120DFNP 20A PLUG ON NEUTRAL DUAL AFCI/GFCI BREAKER NEW picture

1PC SIEMENS Q120DFN Q120DFNP 20A PLUG ON NEUTRAL DUAL AFCI/GFCI BREAKER NEW

$48.99



LOT OF 10 SIEMENS QA115AFCN PLUG ON NEUTRAL (NO WIRE) 15A AFCI ARC FAULT NEW picture

LOT OF 10 SIEMENS QA115AFCN PLUG ON NEUTRAL (NO WIRE) 15A AFCI ARC FAULT NEW

$379.99



Powered by WordPress. Designed by WooThemes