Custom user php.ini for fcgi(FastCGI) PHP handler in cPanel


When the PHP hanlder is set to suPHP user can create their own php.ini files in public_html folder and modify the PHP variables. In case of DSO handler you have directly add php_value & php_flag lines to .htaccess. But fcgi doesn’t provide this option directly. So we will have to create a custom PHP wrapper for the fcgi.

First of all copy the server php.ini to cgi-bin folder of the user account.

cp -a /usr/local/lib/php.ini /home/smp/public_html/cgi-bin/
chown smp:smp /home/smp/public_html/cgi-bin/php.ini

Now create the wrapper script /home/smp/public_html/cgi-bin/php53.fcgi and add the below lines to it.

exec /usr/local/cpanel/cgi-sys/php5

Fix ownership and set the permission to 755 to make it executable.

chown smp:smp /home/smp/public_html/cgi-bin/php53.fcgi
chmod 755 /home/smp/public_html/cgi-bin/php53.fcgi

Now add below lines to .htaccess  files

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

NOTE: The account should have CGI Privilege for this to work.

If you looking for professional server management services at low prices then check out our cPanel Server Management plan.


Sreejit is the founder of Server Management Plus. He has created a lots of automation scripts for the company using which we are able to resolve issue at an extremely fast rate and save lots of time. He has a very keen interest in new technologies and spend most of his free time online researching about it apart from listening music and watching movies.

1 thought on “Custom user php.ini for fcgi(FastCGI) PHP handler in cPanel”

  1. Pingback: Cpanel Fcgi Php.ini – 568 Huiju

Comments are closed.