Specifying separate php.ini/php5.ini files for each hosted website - GoDaddy, Php 5.3

Some times we need to specify a different php5.ini for each of our hosted websites. Some web hosts allow only to keep one php5.ini at the very top root for the master domain. Then add-on domains (allocated to sub directories) may not keep php5.ini in their own root directories. (Of course we can keep the file but server does not parse them).

The solution I found to overcome this problem is to use .user.ini files.

This feature came with Php 5.3.

Step 1

In root directory php5.ini

user_ini.filename = ".user.ini" ; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) user_ini.cache_ttl = 300

Step 2

In each (or some) roots of add-on domains,

create a file called ".user.ini" and specify your site specific settings in those files.

E.g. In .user.ini in the root directory of add-on domain,

open_basedir = "/path/to/site/:/bin/sh:/path/to/tmp"

After doing this, you may need to test whether new settings are effective by creating a php file in the add-on root and enter

<?php phpinfo(); ?>

in the body. Then run it and you will see all the current settings. For more details please follow, http://www.php.net//manual/en/configuration.file.per-user.php

Designed and Developed by Coolbit Software Solutions