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?
|
<Directory
/var/www/vhosts/yourdomain.com/httpdocs> php_admin_flag safe_mode off php_admin_value open_basedir none </Directory> |
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"</Directory>", declaring the end of file. 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. 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.
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.
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'.
Last Updated
27th of February, 2010