Domain Registration
cPanel Login
Webmail Login

Adding a custom php.ini file to web servers running FastCGI

Note: This is not applicabale for our server as we are currently running suPHP


Also see:  http://forums.cpanel.net/f5/individual-php-ini-files-php-fcgi-php-cgi-160398.html

 

PHP FCGI Individual php.ini File

The following steps will allow a custom php.ini file on an account when using

FCGI as the PHP handler.

Copy and Edit default php.ini

Code:

cd /home/user/public-html/cgi-bin

cp /usr/local/lib/php.ini /home/user/public_html/cgi-bin

vi php.ini

As a test change one of the variables like register_globals from:

Code:

register_globals = Off

To:

Code:

register_globals = On

If yours was On, then do the reverse. This is simply to test it changes from

the global php.ini file.

Create php.fcgi file to load custom php.ini

Code:

vi php.fcgi

Please note that you should still be in /home/user/public_html/cgi-bin location.

Put into file:

Code:

#!/bin/sh

export PHP_FCGI_CHILDREN=1

export PHP_FCGI_MAX_REQUESTS=10

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

Please note the path to php5 is due to using PHP5 on this system. If you are

using php4, it might be /usr/local/cpanel/cgi-sys/php4 or some other path.

Check /etc/httpd/conf/php.conf to see what it shows for cgi-sys path for your

version of PHP.

Save file, then made executable:

Code:

chmod +x /home/user/public_html/cgi-bin/php.fcgi

Change ownership of files to correct user:

Code:

chown -R user:user /home/user/public_html/cgi-bin/

Edit .htaccess to point to php.fcgi wrapper

Code:

cd /home/user/public_html

vi .htaccess

Put at top of file:

Code:

AddHandler php5-fastcgi .php

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

Again, here php5 is listed.