Configuring PHP per virtual host

More a note to myself than a regular post: if you need to tweak PHP settings per vhost on your dedicated server, you can do it easily.

  1. I am assuming that you added domain using Plesk. Your domain is accessible as /var/www/vhost/mydomain.com/httpdocs/.
  2. You need root access. So bash$ su.
  3. You need to create vhost.conf file. Using vi: bash$ vi vhost.conf
  4. Use Apache <Directory> directive, sth like this:

<Directory "/var/www/vhosts/mydomain.com/httpdocs">
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/mydomain.com/:/tmp"
php_value display_errors on
</Directory>

For list of available options see: How to change configuration settings.

Once you have updated vhost.conf file you need to notify yous web-server. Again in shell:

bash$ /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=mydomain.com

Finally restart apache:

bash$ /etc/init.d/httpd stop
bash$ /etc/init.d/httpd start

That’s all! Now you have configured your PHP installation to have options peculiar to a selected domain only.

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Reddit
  • Technorati
  • email
  • Print
  • DZone
  • eKudos
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Twitter
, , ,
Trackback

no comment untill now

Add your comment now