Fixing PHP's require "open_basedir restriction in effect" on Plesk
19 comments
Comment from: Evgeny Fadeev [Visitor]
![Evgeny Fadeev Evgeny Fadeev](http://www.gravatar.com/avatar/db77fe6f52095bd53cbd53a406e2c4b2?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
![Jon Jon](http://www.gravatar.com/avatar/1791b6f901731b3ee2f5bdd453924a62?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
![Rob Rob](http://www.gravatar.com/avatar/db376defe55821859599cd5baf1e6539?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
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
![Rob Rob](http://www.gravatar.com/avatar/db376defe55821859599cd5baf1e6539?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
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
![çiçekçi çiçekçi](http://www.gravatar.com/avatar/74118c057d5ef7e927810b78f9ffac3e?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
Comment from: davidnewcomb [Member]
![admin admin](http://www.gravatar.com/avatar/04d8ea8891106e00c746d31da92351c8?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
![Slavi Slavi](http://www.gravatar.com/avatar/fd5bd959efce7d8c5c40518276bb3998?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
@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.
![çiçekçi çiçekçi](http://www.gravatar.com/avatar/7e6f5083eb7c4c5f62fe22510230a8fe?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
![çiçekçi çiçekçi](http://www.gravatar.com/avatar/b5906cfde53ba579c9e9239ba0580828?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
![toymaker toymaker](http://www.gravatar.com/avatar/7277344f37e6f5cf05e567819b63d173?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
![Tom Tom](http://www.gravatar.com/avatar/f02602ceea735faf1f1f8260a1c86f64?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
Comment from: Rich Mehta [Visitor]
![Rich Mehta Rich Mehta](http://www.gravatar.com/avatar/c4a0a7fd1ffd775b04dbae39c2d426be?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
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]
![Dave Cool Dave Cool](http://www.gravatar.com/avatar/a9b06bfdabd619f207099a3fa19e8ceb?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
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]
![Eric Gillette Eric Gillette](http://www.gravatar.com/avatar/8cedac10e48d6d63503b8c0f0e8d2792?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
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]
![prekast prekast](http://www.gravatar.com/avatar/c986c41ddaac898123e5212277587d82?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
Comment from: masoud [Visitor]
![masoud masoud](http://www.gravatar.com/avatar/6ea1317325dca043af4bed83c5a9d70d?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
excuse me does anybody have same problem in windows
what is the solution for IIS server
Comment from: Álvaro G. Vicario [Visitor]
![Álvaro G. Vicario Álvaro G. Vicario](http://www.gravatar.com/avatar/c9e1d852b4d287027fe76f794e506878?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
Comment from: davidnewcomb [Member]
![admin admin](http://www.gravatar.com/avatar/04d8ea8891106e00c746d31da92351c8?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
Comment from: izmir tabela [Visitor]
![izmir tabela izmir tabela](http://www.gravatar.com/avatar/12393d117eab8145d6b70bcb0f923b6a?size=64&default=https%3A%2F%2Fwww.bigsoft.co.uk%2Fmedia%2Fshared%2Fglobal%2Favatars%2Fdefault_avatar_unknown.jpg%3Fmtime%3D1519437290)
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)