VDarricau
VDarricau

Reputation: 3059

PHP error : "open_basedir restriction in effect"

I am actually trying to set up my localhost Wordpress installation to my apache server and I have some trouble to access the index.php or any other file in my Wordpress installation. Indeed I have a blank page while accessing "www.mysite.com/blog". Knowing that I can't modify apache2.conf or any configuration file by myself, I wanted to know if there is any other solution to fix this.

Here is what I obtain in error.log:

[Thu Jul 02 08:57:21 2015] [error] [client 104.6.36.81] PHP Warning:  Unknown: open_basedir restriction in effect. File(/var/www/vhosts/mysite.com/httpdocs/blog/index.php) is not within the allowed path(s): (/var/www/vhosts/mysite.com/httpdocs:/tmp) in Unknown on line 0
[Thu Jul 02 08:57:21 2015] [error] [client 104.6.36.81] PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[Thu Jul 02 08:57:21 2015] [error] [client 104.6.36.81] PHP Fatal error:  Unknown: Failed opening required '/var/www/vhosts/mysite.com/httpdocs/blog/index.php' (include_path='.:') in Unknown on line 0

Moreover, the owner of "blog" is me.

Any help would be welcomed :)

Upvotes: 2

Views: 13966

Answers (1)

markratledge
markratledge

Reputation: 17561

First, 777 permissions are bad, even on localhost where there is limited external access. Changing File Permissions « WordPress Codex for the correct and secure permissions scheme.

Second, open_basedir restriction in effect is a PHP configuration error. You need to make changes in httpd.conf. You need to find the location of httpd.conf for your OS and Apache.

See http://php.net/manual/en/ini.core.php#ini.open-basedir :

In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none"

Upvotes: 3

Related Questions