custom “php.ini” with PHP5 on Fastcgi

If you use FastCGI (called FCGI too,) as a PHP Loader on a server you won’t be able to set custom php values into .htaccessfile. instead you will have to create a wrapper for the main FCGI binary which makes the php.ini loaded from it’s current working directory instead of server-wide one! to achieve that follow this instructions.


Open “.htaccess” file for the account you want to use custom php.ini file and insert following lines to the bottom of the file:

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



Then you need to copy the source php.ini file which is located in /usr/local/lib to account cgi-bin directory. be aware that you have to fix the ownership issues that happen when you use root user to copy the file.

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



Now you have to create the wrapper script. create a file in cgi-bin directory and name it php5.fcgi and enter following content into it.

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


Finally, make sure the ownership and permissions are correct.

chown user:user php5.fcgi && hmod 0755 php5.fcgi


Incoming search terms:

  • Source:
  • Source:
  • custom php ini cpanel fast cgi
  • custom php ini for fcgi
  • fast-cgi php ini
  • php fastcgi php ini
  • php ini fcgi
  • php5 fastcgi

Leave a comment

Leave a Reply