Search

Search for:
Language:  

No categories for selected product

[How to] I get an "open_basedir" error in the PHP script. How can I fix it?

Article ID: 432 
Last Review: May, 11 2012
Views:
APPLIES TO:
  • Parallels Plesk Panel for Linux/Unix

Cause

This error means that the PHP script is trying to access a folder for which access is not allowed. For security reasons, PHP options for domains hosted in Parallels Plesk Panel (PP) allow access to the /tmp and http(s)docs folders only by default. Restrictions are limited by the open_basedir PHP variable for each virtual host separately.

Resolution

In case you need to allow access with PHP scripts of a certain virtual host to additional folder(s), you should set up an option 'open_basedir' for the virtual host with the new path value, splitting the folder names with colons as described below.

Warning: Doing so may put your server under risk of being compromised, make sure you understand the consequences.


For Parallels Plesk Panel 10.3 and later versions:

This can be done in the PP web interface, see this article:

113861 [Info] Customizing PHP settings for a particular domain in PP 10.3 and later versions


In PP versions prior to 10.3:

This action can only be made by a user with root privileges on the domains’ vhost.conf or vhost_ssl.conf files (for SSL virtual host). For more information, read the article 'Including Directives into Configuration File of Web Serve'
in the Parallels Plesk Panel documentation.

Once you have applied these changes, you should recreate Apache’s configuration files and restart the Apache service using the following command in the shell. If the vhost(_ssl).conf file is found, then it will be added automatically to the httpd.include file of the domain:

This command is for PP 10.x:
~# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all


For versions 9.x and older use this command instead:
~# /usr/local/psa/admin/sbin/websrvmng -a -v


NOTE: If you do not run the command above, vhost.conf or vhost_ssl.conf will not be included in Apache configuration and the changes will not take effect.
 

Example:

NOTE: HTTPD_VHOSTS_D needs to be replaced by a real path to the domain location, which may vary according to the OS and Parallels Plesk Panel version. You can look up the current value in the /etc/psa/psa.conf file. ADD_PATH needs to be replaced by a real path to the folder to which we are granting access.

Create HTTPD_VHOSTS_D/domain.com/conf/vhost.conf: 

---8<---

php_admin_value open_basedir HTTPD_VHOSTS_D/domain.com/httpdocs:/tmp:/ADD_PATH


--->8---

 Create HTTPD_VHOSTS_D/domain.com/conf/vhost_ssl.conf:

---8<---

php_admin_value open_basedir HTTPD_VHOSTS_D/domain.com/httpsdocs:/tmp:/ADD_PATH


--->8---

For subdomains, create the corresponding HTTPD_VHOSTS_D/domain.tld/subdomains/subdomain/conf/vhost.conf file:

---8<---

php_admin_value open_basedir "HTTPD_VHOSTS_D/domain.com/subdomains/subdomain/httpdocs:/tmp:/ADD_PATH"


--->8---

 Also, you can set up a global 'open_basedir' for a specific location required in /etc/php.ini. For example:

---8<---
open_basedir = "/tmp"
--->8---

 Once php.ini is changed, restart Apache.






Email subscription for changes to this article Email subscription for changes to this article

Please provide feedback on this article

* Did this article help you solve your issue?
Yes
No
What can we do to improve this article?

PLEASE NOTE: Knowledge Base feedback is reviewed occasionally and we do not reply to most of the individual comments. Please contact us using one of the Support channels for a response to any support inquiries. We appreciate your feedback.

Subscribe me for article updates. My email
 
 
 
 
 
 
For Home
For Hosters
For SaaS
For IaaS
For Developers
For Health Care
 
Desktop Virtualization
- Parallels Desktop 7 for Mac
- Parallels Transporter
- Parallels Mobile
- Parallels Desktop Switch to Mac Edition
- Parallels Workstation
- Parallels Workstation Extreme
- Parallels Desktop for Mac Enterprise Edition
Server Virtualization
- Parallels Server for Mac 4.0
- Parallels Server for Mac 4.0 Mac mini Edition
- Parallels Server for Mac Bare Metal Edition
- Parallels Server Bare Metal
- Parallels Virtuozzo Containers
Automation
- Parallels Operations Automation
- Parallels Automation for Cloud Infrastructure
- Parallels Business Automation
- Parallels Business Automation Standard
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
- Parallels Small Business Panel
- Parallels Domain/SSL Reseller Program
- Parallels Partner Storefront
More Products