custom php.ini is not loading – cpanel

CUSTOM PHP.INI NOT LOADING IN SUPHP|SUEXEC SERVER

I have followed the following steps to create custom php.ini for a user in cpanel server. There is suphp enabled in the server.

# cp /usr/local/lib/php.ini /home/<user>/public_html/php.ini

I have created a phpinfo page and accessed in browser and it is found that it still loading server’s default(/usr/local/lib/php.ini) php.ini

Later it is found that there is SuExec Enabled Server.

root@server [~]# httpd -M | grep su
suexec_module (static)
suphp_module (shared)
Syntax OK
The configuration changes given below will help you to enable Custom php.ini on SuExec and suphp Enabled Server.

Open /opt/suphp/etc/suphp.conf in yourfavourate editor and search for the following lines.

[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
application/x-httpd-php=/usr/local/lib/
application/x-httpd-php4=/usr/local/php4/lib/
application/x-httpd-php5=/usr/local/lib/
The above suphp configuration forces suphp to use the php.ini from /usr/local/lib/. You can comment those line to resolve the loading issue of custom php.ini file. So the configuation will look like as follows after the change.

[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
;application/x-httpd-php=/usr/local/lib/
;application/x-httpd-php4=/usr/local/php4/lib/
;application/x-httpd-php5=/usr/local/lib/
Once you made the changes, restart apache to make changes in effective.

# /etc/init.d/httpd restart
Try to load phpinfo page again and verify the result.
Reference:
http://blog.philipbrown.id.au/2009/08/php-suexec-and-custom-php-ini-files/
http://www.askapache.com/php/custom-phpini-tips-and-tricks.html
http://forums.cpanel.net/f185/methods-increase-security-suphp-restricting-who-can-use-php-ini-files-167186.html