Custom php.ini not working

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).

Benefits:

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

Contents:

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


Name : php.ini

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

max_execution_time=600

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

extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so




  • 603 Users Found This Useful
Was this answer helpful?

Related Articles

500 Internal Server Error

If you have visited your web site and you're receiving the "500 - Internal Server Error" message,...

My Website shows as Suspended

If you are browsing to your web site and you encounter a "Web Site Suspended" or "Web Site...