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 140CPU65150 processor module 140CPU65150 140CPU65150 picture

Schneider 140CPU65150 processor module 140CPU65150 140CPU65150

$2898.00



Allen Bradley 1747-L552 /D SLC 5/05 PLC Ethernet Processor #K-1922 picture

Allen Bradley 1747-L552 /D SLC 5/05 PLC Ethernet Processor #K-1922

$2204.00



Intel Core i5-13500T - 2.3GHz Processor  Desktop Processor SRH3B picture

Intel Core i5-13500T - 2.3GHz Processor Desktop Processor SRH3B

$85.00



AlphaSmart Neo2 Laptop Word Processor Portable Notebook Pad picture

AlphaSmart Neo2 Laptop Word Processor Portable Notebook Pad

$89.97



AlphaSmart Neo2 Laptop Word Processor, . picture

AlphaSmart Neo2 Laptop Word Processor, .

$90.00



Intel Core i5-12500T ES QYGD 1.4GHz 6Core 12Thread 35W LGA1700 CPU Processor picture

Intel Core i5-12500T ES QYGD 1.4GHz 6Core 12Thread 35W LGA1700 CPU Processor

$121.16



DOERR LR-22132 AC MOTOR 3PH 1/2HP 1725RPM FR: F56 LR22132 picture

DOERR LR-22132 AC MOTOR 3PH 1/2HP 1725RPM FR: F56 LR22132

$71.00



NORDSON 8503591A HOT MELT MODULE 240V 150W BCS-CBST-STD01ACA picture

NORDSON 8503591A HOT MELT MODULE 240V 150W BCS-CBST-STD01ACA

$625.00



Ranger Automation Systems Inc. Controller CPU Board R-ABPCB picture

Ranger Automation Systems Inc. Controller CPU Board R-ABPCB

$100.00



For Metal/arc/laser Welding 1000W Welding Bead Processor Weld Cleaning Machine picture

For Metal/arc/laser Welding 1000W Welding Bead Processor Weld Cleaning Machine

$204.00



Powered by WordPress. Designed by WooThemes