How can I run a custom php.ini for each domain if I have plesk?

Often times you'll need to change a few settings in PHP for one domain on your server, but not another. An example would be if you need to enable open_basedir for one of the domains that you host on your dedicated server, while not affecting the other domains. This can safely be done by using vhost.conf. The vhost.conf file is usually found at:


What should I put in my vhost.conf file?


The vhost.conf file is very similar to the php.ini config file, with a few small differences. Below is a very simple example of what a vhost.conf file might look like

    php_admin_flag safe_mode off
    php_admin_value open_basedir none

Notice that the first line of the file should point to the directory of your websites content. The last line of the file will always contain"", declaring the end of file.
At this point you can start adding settings to your new vhost.conf file. This is where a good working knowledge of the php.ini file comes in handy.

The content of the vhost.conf file is similar but different than that of the php.ini file. As you can see in the above example, we've disabled safe_mode and open_basedir. You may have noticed the major difference between vhost.conf and php.ini already. As you can see we've added 'php_admin_flag' and 'php_admin_value' in front of the actual setting. Also, in vhost.conf there is no '=' between the setting and the value.

php_admin_flag - You will pre-pend your desired setting with this string if the setting you are changing is a boolean expression. Meaning, if its on or off, true or false.

php_admin_value - This is used if the value is not simply 'on' or 'off'.

You can now add any setting from php.ini into the vhost.conf.

How to make the changes effective?

Once you have made the changes in the vhost.conf file you will need to make the effective for the domain, to do this you must execute "/usr/local/psa/admin/bin/websrvmng -a -v" from the SSH shell but with out the quote marks.

This article has been provided by Codero Hosting, the leading provider of reliable dedicated, managed and cloud hosting services. Need more information on this topic or to learn more about Codero’s hosting services please visit www.codero.comchat with us online or give us a call at 866-2-CODERO.



Posted in
Last update:
2015-12-03 20:39
Average rating:0 (0 Votes)