Fixing PHP's require "open_basedir restriction in effect" on Plesk
19 comments
Comment from: Evgeny Fadeev [Visitor]
I have followed the steps above (I even remembered to restart the server on the second attempt ;-) but it has made no difference to the results (see below). I am using Plesk 8.
I tried adding “:/images:/properties” after “…:/tmp” in the following line:
“/var/www/vhosts/your.domain/httpdocs:.:/php:/tmp”
but that either doesn’t work or didn’t make any difference.
Is it possible to tell from the error code below what modifications might be necessary?
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/properties/thumb_39312380.jpg) is not within the allowed path(s): (/var/www/vhosts/mydomain.net.nz/httpdocs:/tmp) in /var/www/vhosts/mydomain.net.nz/httpdocs/property_list.php on line 191
Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘properties/thumb_39312380.jpg’ for writing in /var/www/vhosts/mydomain.net.nz/httpdocs/images/Thumbnail.php on line 196
/properties/thumb_39312380.jpg” />
Thanks,
Rob
I spoke to my server provider support team and they fixed the open_basedir problem by replacing everything in the vhost.conf file with:
<directory /var/www/vhostsrenttoown.net.nz/httpdocs>
php_admin_value open_basedir none
php_admin_flag safe_mode 0
<Directory/>
Obviously most server setups are unique so I presume that’s why this worked for me and your solution worked for you.
Cheers,
Rob
Comment from: davidnewcomb [Member]
@Evgeny Fadeev
Don’t know why but disabling statement was ineffective in the main section of the httpd.conf
It seems each /conf/httpd.include lists allowed directories for open basedir. That’s done for each vhost.
Comment from: Rich Mehta [Visitor]
That’s a great tip. Fixed my subdomain problem straight away. Although I didn’t restart the whole Apache server (I’ve got a few sites on the same box); I just ran
/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=your.domain
Comment from: Dave Cool [Visitor]
Restarting apache didn’t seem to work for me for some reason, however Rich Mehta’s tip did. The only problem was the websrvmng was “obsolete” so I had to use
/usr/local/psa/admin/sbin/httpdmng –reconfigure-domain your.domain
Comment from: Eric Gillette [Visitor]
Yeah, this worked for me too on Plesk 8.6 by simply appending the appropriate directory (i.e. ./:/tmp:/var/tmp
)
Then restarted the web server:
service httpd restart
Or for those of you without the service wrapper, try this:
/etc/init.d/httpd restart
Comment from: prekast [Visitor]
Comment from: masoud [Visitor]
excuse me does anybody have same problem in windows
what is the solution for IIS server
Comment from: Álvaro G. Vicario [Visitor]
Comment from: davidnewcomb [Member]
Comment from: izmir tabela [Visitor]
Form is loading...
enclosing php_admin_flag safe_mode off into <Directory> directive.
to disable PHP safe_mode. and set open_basedir
Don’t know why but disabling statement was ineffective in the main section of the httpd.conf
I use PHP 5.1.6/Apache/2.2.3 API version 20051115 (CentOS)