2

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 :)

6
  • that is NOT an apache error. that's PHP, which happens to be logging via apache... And changing the permissions on the folder is pointless. open_basedir is PREVENTING access to that folder, because it's outside the allowable directories. Commented Jul 2, 2015 at 14:12
  • @MarcB Thanks for helping. So what do you think I should do to solve this? Commented Jul 2, 2015 at 14:14
  • php.net/manual/en/ini.core.php#ini.open-basedir Commented Jul 2, 2015 at 14:14
  • Thank you for the help. I think there is no solution instead of modifying vhost.conf by adding php_admin_value open_basedir "/var/www/vhosts/mysite.com/blog:/var/www/vhosts/mysite.com/httpdocs:/tmp". I'll try to contact my server owner for doing this. Thanks anyway! Commented Jul 2, 2015 at 14:27
  • essentially not. it'd be like "I'm a prisoner in a jail. is there any easy workaround for walking out the front door?"... what'd be the point of being in jail if you could just bypass the jail's security anytime you wanted? Commented Jul 2, 2015 at 14:28

1 Answer 1

3

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"

Sign up to request clarification or add additional context in comments.

7 Comments

/var/www/vhosts/mysite.com/httpdocs/blog is in the allowed path /var/www/vhosts/mysite.com/httpdocs Something else is causing the error. Just setting open_basedir to none would work, but the hosting company will probably not do that.
After doing some researches I have actually figured out that modifying vhost was the solution. But I was looking for another one because I have to contact my server for any changes in my configuration files. Why do you think the hosting company will refuse?
What did you add to vhosts then? Did you tamper the log in your question?
They won't just refuse a change. But setting open_basedir to none has quite some implications, at least, to them. So they will probably tell you that because of "security considerations" they won't set it to none. If you set it to "/var/www/vhosts/mysite.com/blog:/var/www/vhosts/mysite.com/httpdocs:/tmp" like in your comment, then the error should still occur, that is, if the index.php is in /var/www/vhosts/mysite.com/httpdocs/blog and not /var/www/vhosts/mysite.com/blog as per your suggested change.
In fact /var/www/vhosts/mysite.com/httpdocs/blog is a symlink to /var/www/vhosts/mysite.com/blog so according to what you just said it should be good. Right?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.