Sunday, March 3, 2013

Adding custom php.ini for php5


php5 doesn't check for custom php.ini files like php4 does. To hack this, there is simply method

1)Create a script php5-cgi in /home/username/public_html/cgi-bin with permission 755 and owership username. Add the entries
" #!/bin/sh
exec /usr/local/cpanel/cgi-sys/php5 -c /home/username/public_html/php.ini "
2)Create a .htaccess in the directory you need custom php5 configuration working with the following code in it.
Options All -Indexes
AddHandler php5 .php
Action php5 /cgi-bin/php5.cgi

3) Copy the php.ini file that is currently used( php -i | grep php.ini ) to /home/username/public_html and change according to your needs.
If any error occurs , please check ScriptAlias is set for cgi-bin folder or try changing the Handler name or add AddType.

No comments:

Post a Comment