To configure the custom php environment (php.ini) settings for the accounts on the server running FCGI following steps are needed to be followed.

Access the cgi-bin location in the root of your website

cd /home/cpanel-user/public-html/cgi-bin

Copy the php.ini to it

cp /usr/local/lib/php.ini /home/cpanel-user/public_html/cgi-bin

Edit the php.ini as per the requirement

vi php.ini

Now create php.fcgi file to load the custom php.ini in /home/cpanel-user/public_html/cgi-bin with the following code

#!/bin/sh
export PHP_FCGI_CHILDREN=1
export PHP_FCGI_MAX_REQUESTS=10
exec /usr/local/cpanel/cgi-sys/php5

Note:- exec path in the above code is accordence with cgi-sys path for your version of PHP in the file /etc/httpd/conf/php.conf

Correct the ownership and permssion of the files

chown -R user.user /home/cpanel-user/public_html/cgi-bin/
chmod 755 /home/cpanel-user/public_html/cgi-bin/php.fcgi

Now edit the .htaccess file in the root to point to php.fcgi wrapper

cd /home/cpanel-user/public_html
vi .htaccess

Add the following code

AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.fcgi

Add the following lines to /usr/local/apache/conf/php.conf file:

Action php5-fastcgi /cgi-bin/php.fcgi
AddType application/x-httpd-php .php

The file should appear like the following

# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 500
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
Action php5-fastcgi /cgi-bin/php.fcgi
AddType application/x-httpd-php .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml

Now rebuild the apache configurations

/usr/local/cpanel/bin/apache_conf_distiller –update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart

Now create the phpinfo page by executing the following commnd from /home/cpanel-user/public_html

echo “<? phpinfo (); ?>” > info.php ; for i in `ls -ld . | awk ‘{print $3}’ `;do chown $i.$i info.php;done

Check the Loaded Configuration File in the phpinfo page at the URL :- http://yourdomain/info.php