Wednesday, June 26, 2013

Custom php.ini on shared hosting

  • Find the default php.ini path. Mine is /usr/local/lib/php.ini
<?php phpinfo() ?>
  • Copy the default php.ini to the user's home folder and customise it.
<?php copy("/usr/local/lib/php.ini", "/home/username/php.ini") ?>
  • Create a .htaccess file in the user's home folder with the following content.
SetEnv PHPRC /home/username/php.ini
# The following lines are important if the php.ini file is put in the document root.
<Files php.ini>
order allow,deny
deny from all
</Files>
Refs

No comments:

Post a Comment