Plesk Server open_basedir Restriction Error

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.

Related posts:

  1. Installing mod_security in Plesk server
  2. Apache not working, server can’t ping outside
  3. FreeBSD Log File Rotation with NewSysLog
  4. XPanel installation
  5. Bulk Parking multiple web sites in Cpanel
This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Plesk Server open_basedir Restriction Error

  1. Anonymous says:

    For others who were searching to a solution for this problem, this method is only a temporary fix. Make any changes to your domain accounts in Plesk and your changes will be removed.

  2. Anonymous says:

    Your changes will be removed the next time plesk reconfigures that domains hhtp.include file. Leading to breakage for unknown reasons. Please add and edit a file called vhost.conf instead. google for more information. -mf

  3. TC says:

    However, if you make any changes to plesk like create sub domains, upgrade plesk, all the http.include files will be rewritten and you’ll have the open_basedir problem again.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>