HostOnNet Blog

Plesk Server open_basedir Restriction Error

Looking for Linux Server Admin or WordPress Expert? We can help.

On a Plesk server, when client run a PHP script that need pear, got following error
 
Warning: main(): open_basedir restriction in effect.
File(/usr/share/ pear/DB.php) is not within the allowed path(s):
(/var/www/vhosts/ gstacks.com/httpdocs:/tmp) in
/var/www/vhosts/ gstacks.com/httpdocs/ cpadmin/db_connect.php on line 9
 
The problem is open_basedir value do not allow accessing pear. open_basedir is used to secure the server, limit each sites within the sites folder. If this is disabled, a PHP script running in one site can access files in other site.
 
Since this was a dedicated server, only host the clients own sites, its ok to disable open_basedir.
 
In Plesk server, Apache configuration for each site are stored in its own file and included in httpd.conf. In Cpanel server, all sites virtual host information is stored in file httpd.conf itself. Recently i have found on a cpanel server, a new folder “sites” in /usr/local/apache/conf folder, which have configuration of each web sites, it seems Cpanel is also going in this direction. This will help when deleting a web site, creating a web site, the program don’t have to perate in big httpd.conf file.
 
In Plesk each web sites configuration is stored in
 
/var/www/vhosts/domain.extn/conf/httpd.include
 
File. To remove open_basedir restriction, i edited the file and commented out the line for open_basedir.
 
 

php_admin_flag engine on
# php_admin_value open_basedir “/var/www/vhosts/ stacks.com/httpdocs:/tmp”
 
Now restart Apache with
 
service httpd restart
 
After restart, the site will work fine.

Posted in Uncategorized. Bookmark the permalink.

3 Responses to Plesk Server open_basedir Restriction Error

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.