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.

Show 1 Comment

1 Comment

Comments are closed