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.
- Edit or create a
vhost.conffile inside this folder:/var/www/vhosts/YOURDOMAIN.COM/conf/. ReplaceYOURDOMAIN.COMwith the domain you wish to configure. 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/PATHwith a path you want added to theopen_basedirwhitelist. You can add more, just separate them with colons (:).Reconfigure the webserver so
vhost.confwill be applied./usr/local/psa/admin/sbin/httpdmng --reconfigure-domain YOURDOMAIN.COMRestart Apache
/etc/init.d/httpd restartDone! Check the value of
open_basedirinphpinfo()to see if it worked.
8 Responses to Adding allowed open_basedir paths in a MediaTemple DV
I keep trying to attempt this on my media temple server for a client, and I get the error that I can’t even open the /conf folder. Clearly a permissions issue, but is this something I can bypass in mediatemple/plesk?
Thanks, -Chris.
Yep, I think it is a permission error. I was using root (SSH) when I accessed it. I haven’t tried doing this inside Plesk though, sorry.
Managed to get SSH access from the client, and I’m still stuck though, because it appears the httpdmng command isn’t available to me. Thank you for your help, regardless. -Chris.
@Chris, it could be your using an old media temple DV. Check this out if it works. It’s using websrvmng instead of httpddmng.
That worked. Thank you. I didn’t solve my problem, but likely that was because I have the incorrect path set. Clearly I don’t spend enough time on the server configurations! I’ll keep messing around with it.
Thank you very much, Shiki.
Hey guys, I rarely ever post anything, but this issue was kicking my A** for about a week until I solved it! Seems that all the post I read were not explained properly. The above led me to the right track, but I have a little different setup, as I’m running a few domains on my server and only wanted to add a new path for one file that was giving an issue. Many of the other tutorials were way off for my needs, so I hope this helps someone. The problem was Jomsocials wordfilter.php not in the tmp path so the profile page showed the ugly warning. I simply used winscp program to login as root via sftp option. You can use ftp, but I like to be safe. From there, I navigated to the path where the httpd.includes file is > /var/www/vhosts/yourdomain.com/conf Open the file and add the info.
Here is the entire line of code that will be added for php 4 and php 5. Use the quotes on the ends and separate the second path with a colon and no spaces. As you can see, there are 2 paths in the below code, with the second starting after /tmp. The original path ended like this httpdocs:/tmp” so to add new path remove quotes and replace with colon and so forth, ending with the quotes. “/var/www/vhosts/yourdomain.com/httpdocs:/tmp:/var/www/vhosts/yourdomain.com/httpdocs:/plugins/community/wordfilter.php”
Go into plesk if you have it and stop and restart apache and you should be good to go, or use the ssh command above if it will work for you. Hope this helps someone and saves your a week.
@Allen I’m glad I helped a little :)
And in Plesk 10.4, open_basedir can be edited right in UI, just click on domain name and then “PHP Settings”