Adding allowed open_basedir paths in a MediaTemple DV


This is a quick fix for PHP errors like these on a Media Temple DV:

Warning: include_once() [function.include-once]: open_basedir restriction in effect. 

I got this a few days ago when trying to setup an app. There are instructions in Media Temple’s site on how to fix this but this set of steps is what worked for me.

  1. Edit or create a vhost.conf file inside this folder: /var/www/vhosts/YOURDOMAIN.COM/conf/. Replace YOURDOMAIN.COM with the domain you wish to configure.
  2. Add this in vhost.conf:

     <Directory /var/www/vhosts/YOURDOMAIN.COM/httpdocs>
       <IfModule sapi_apache2.c>
         php_admin_value open_basedir "/var/www/vhosts/YOURDOMAIN.COM/httpdocs:/tmp:/ADDITIONAL/PATH"
       </IfModule>
       <IfModule mod_php5.c>
         php_admin_value open_basedir "/var/www/vhosts/YOURDOMAIN.COM/httpdocs:/tmp:/ADDITIONAL/PATH"
       </IfModule>
     </Directory>
    

Replace /ADDITIONAL/PATH with a path you want added to the open_basedir whitelist. You can add more, just separate them with colons (:).

  1. Reconfigure the webserver so vhost.conf will be applied.

     /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain YOURDOMAIN.COM
    
  2. Restart Apache

     /etc/init.d/httpd restart
    
  3. Done! Check the value of open_basedir in phpinfo() to see if it worked.