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.


Johnson Controls SNE 10501 Metasys M4-SNE10501-0 Controller picture

Johnson Controls SNE 10501 Metasys M4-SNE10501-0 Controller

$999.00



Johnson Controls T-4002-201 Pneumatic Thermostat Temperature Heating T-4002-6201 picture

Johnson Controls T-4002-201 Pneumatic Thermostat Temperature Heating T-4002-6201

$125.99



Johnson Controls A421ABC-02C Line-Voltage Type 1 Temperature Control picture

Johnson Controls A421ABC-02C Line-Voltage Type 1 Temperature Control

$91.81



Johnson Controls JH13A020 / AH13A020, 24V PopTop HCO Actuator picture

Johnson Controls JH13A020 / AH13A020, 24V PopTop HCO Actuator

$40.00



Johnson Controls YORK 031-02060-001 03102060001 Trigger Board - USA STOCK picture

Johnson Controls YORK 031-02060-001 03102060001 Trigger Board - USA STOCK

$1549.98



Johnson Controls Furnace Control Board- S1-03103010000 Single Stage picture

Johnson Controls Furnace Control Board- S1-03103010000 Single Stage

$115.00



Johnson Controls F4-CVM03050-0 CVM03050 controller picture

Johnson Controls F4-CVM03050-0 CVM03050 controller

$100.00



Johnson Controls - P100da-81C Single Pressure Control,High Pressure picture

Johnson Controls - P100da-81C Single Pressure Control,High Pressure

$15.00



Johnson Controls NSB8BHC340-0 Network Temperature, RH and CO2 Combo Sensor picture

Johnson Controls NSB8BHC340-0 Network Temperature, RH and CO2 Combo Sensor

$175.00



Johnson Controls MS-VMA 1630-1 Actuator Assembly for Cooling and Reheating picture

Johnson Controls MS-VMA 1630-1 Actuator Assembly for Cooling and Reheating

$150.00



Powered by WordPress. Designed by WooThemes