Thursday, 12 December 2013

Create custom php.ini file cPanel

1) Copy /usr/local/lib/php.ini to the site's Web root folder (public_html). Via SSH:
 php -i | grep php.ini

 cp /usr/local/lib/php.ini /home/USERNAME/public_html  

2) Make sure the file is owned by their cPanel user via SSH:  
 chown USERNAME:USERNAME php.ini

3) Edit .htaccess file and put there the path to your php.ini file. 
  suPHP_ConfigPath /home/username/public_html

--------------------------------------------------------------

 
Custom php.ini in server using php handler fcgi
http://blog.arvixe.com/how-to-add-custom-php-ini-for-servers-running-fastcgi/


Below are the steps to enable custom php.ini for FastCGI PHP handler:
Open .htaccess of the user and add the below codes:

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


Move to the cgi-bin folder of the account

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

cd /home/user/public_html/cgi-bin/

vi php5.fcgi  (insert the below codes and save)

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


Save and quit the file

chmod 755 /home/user/public_html/cgi-bin/php5.fcgi

No comments:

Post a Comment