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.


2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW picture

2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW

$23.90



EEPROM BIOS USB Programmer CH341A + SOIC8 Clip + 1.8V Adapter + SOIC8 Ad picture

EEPROM BIOS USB Programmer CH341A + SOIC8 Clip + 1.8V Adapter + SOIC8 Ad

$18.84



TORK DZS200BP 2CH Timer, Astronomic Option w/ Portable Memory Module. FREE X-PRS picture

TORK DZS200BP 2CH Timer, Astronomic Option w/ Portable Memory Module. FREE X-PRS

$499.00



ESP32 CYD Marauder WiFi Bluetooth Sniffer Touch Screen w/ Case (NEWEST UPDATE) picture

ESP32 CYD Marauder WiFi Bluetooth Sniffer Touch Screen w/ Case (NEWEST UPDATE)

$45.00



🔥🔥 2 Pack x Kingston 4GB SD CARD CLASS 2 SD4 Flash Memory Card Camera🔥🔥 picture

🔥🔥 2 Pack x Kingston 4GB SD CARD CLASS 2 SD4 Flash Memory Card Camera🔥🔥

$12.00



4In1 DDR3 DDR4 DDR5 UDIMM & Server DDR5 RDIMM RAM Memory Diagnostic Tester Card picture

4In1 DDR3 DDR4 DDR5 UDIMM & Server DDR5 RDIMM RAM Memory Diagnostic Tester Card

$36.00



OEM Sony PlayStation PS2 Black Replacement Case Memory Card Slot Lot of 50 picture

OEM Sony PlayStation PS2 Black Replacement Case Memory Card Slot Lot of 50

$99.99



[ BULK LOT OF 10 ] UNITS of 8GB DDR4 Laptop RAM SAMSUNG, HYNIX etc. picture

[ BULK LOT OF 10 ] UNITS of 8GB DDR4 Laptop RAM SAMSUNG, HYNIX etc.

$65.00



HyperDisk DOM SSD 16G 44 Pins Module Industrial IDE Flash Memory Disk MLC picture

HyperDisk DOM SSD 16G 44 Pins Module Industrial IDE Flash Memory Disk MLC

$13.49



2X MICRON TECHNOLOGY INC MT16LSDT3264AG-133E3 256MG Ram Memory Stick picture

2X MICRON TECHNOLOGY INC MT16LSDT3264AG-133E3 256MG Ram Memory Stick

$10.00



Powered by WordPress. Designed by WooThemes