Custom php.ini not working Print

  • 603

Some of our servers has been  moved to FastCGI so using custom php.ini will be bit different now. Also FastCGI uses only one php.ini file located in the cgi-bin directory

FastCGI for PHP makes all your PHP applications persistant. There is no per-request startup and initialization overhead. This makes possible the development of applications that would otherwise be impractical within the CGI paradigm (e.g. a huge PHP script or an application that requires a connection to one or more databases).


PHP scripts will run faster. The PHP interpreter is loaded into memory rather than calling from storage for every hit, having the ability to improve performance of your scripted site. The load on the Server Resources can be lessened with the use of FastCGI. Since the server does not have to load the PHP interpreter for each hit, thus providing faster service to clients.

To use custom php.ini use following steps


1) Go to /home/ /public_html/cgi-bin
2) Create following two files in it

Name : php5.fcgi


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

Name : php.ini

Contents: ( You can add other required php values in this)


3) Go to /home/ /public_html/ and create .htaccess file with following content

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


Note 1:Make sure permissions are set to 755 for php5.fcgi file.
Note 2:If you have multiple domains under one account, then create cgi-bin directory under domain specific directory and follow above steps.
Note 3 : If you want to load php modules like PDO, etc then you can add entries in php.ini like

Was this answer helpful?

« Back