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.


USED FANUC A20B-3900-0160/04A SRAM MEMORY CARD A20B-3900-0160 picture

USED FANUC A20B-3900-0160/04A SRAM MEMORY CARD A20B-3900-0160

$250.00



6ES7954-8LE03-0AA0 SIEMENS picture

6ES7954-8LE03-0AA0 SIEMENS

$199.00



MICRO DNC2 picture

MICRO DNC2

$189.00



Allen Bradley 1746-OB16 SLC 500 Output Module Memory Ethernet picture

Allen Bradley 1746-OB16 SLC 500 Output Module Memory Ethernet

$53.99



NewSiemens 6ES7954-8LL03-0AA0 6ES7 954-8LL03-0AA0 S7 MEMORY CARD FOR S7-1X00 CPU picture

NewSiemens 6ES7954-8LL03-0AA0 6ES7 954-8LL03-0AA0 S7 MEMORY CARD FOR S7-1X00 CPU

$341.38



🔥🔥 Pack of 10 x Genuine SanDisk 2GB SD CARD CLASS 2 SDHC Flash Memory Card 🔥 picture

🔥🔥 Pack of 10 x Genuine SanDisk 2GB SD CARD CLASS 2 SDHC Flash Memory Card 🔥

$17.50



AM2976PC, AMD.  Dynamic Memory Driver. picture

AM2976PC, AMD. Dynamic Memory Driver.

$50.00



New Siemens 6ES7953-8LG20-0AA0 6ES7 953-8LG20-0AA0  SIMATIC S7 Micro Memory Card picture

New Siemens 6ES7953-8LG20-0AA0 6ES7 953-8LG20-0AA0 SIMATIC S7 Micro Memory Card

$54.36



Digital Spy Voice Activated Recorder Mini Hidden Audio Recording Device 16/32GB picture

Digital Spy Voice Activated Recorder Mini Hidden Audio Recording Device 16/32GB

$35.60



Digiprog 3 V4.94 Auto Car Mileage Correction Odometer Adjustment Tool picture

Digiprog 3 V4.94 Auto Car Mileage Correction Odometer Adjustment Tool

$133.69



Powered by WordPress. Designed by WooThemes