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.


Schneider Electric Energy Server EBX510 Server For Energy Management- picture

Schneider Electric Energy Server EBX510 Server For Energy Management-

$4350.00



FANUC Server Driver A06B-6077-H111 picture

FANUC Server Driver A06B-6077-H111

$2029.33



FANUC Server Driver A06B-6117-H211 picture

FANUC Server Driver A06B-6117-H211

$3754.35



Schweitzer Engineering Laboratories - Intelligent Server Model: SEL3332 picture

Schweitzer Engineering Laboratories - Intelligent Server Model: SEL3332

$239.99



Bunn Coffee Shop Equipment RWS1 12203.0010 Electric Soft Heat Server Warmer picture

Bunn Coffee Shop Equipment RWS1 12203.0010 Electric Soft Heat Server Warmer

$99.00



Server Books for Waitress - Leather Waiter Book Server Wallet with Zipper, Cute picture

Server Books for Waitress - Leather Waiter Book Server Wallet with Zipper, Cute

$10.88



3 Section Buffet Server & Food Warmer in Stainless Steel picture

3 Section Buffet Server & Food Warmer in Stainless Steel

$25.27



Server Aprons with 3 Pockets, Black Server Waist Aprons, Waitress Half Apron,... picture

Server Aprons with 3 Pockets, Black Server Waist Aprons, Waitress Half Apron,...

$14.58



USA Windows VPS Server / RDP Server / VPS Hosting 12GB RAM 400GB HDD 12 Month picture

USA Windows VPS Server / RDP Server / VPS Hosting 12GB RAM 400GB HDD 12 Month

$335.00



Server 82740-315 FOUNTAIN PUMP picture

Server 82740-315 FOUNTAIN PUMP

$195.00



Powered by WordPress. Designed by WooThemes