I get a similar problem after manually upgrading to WordPress 3.0.4 and going to domainname.com/wp-admin/ I get the following error:
Fatal error: require_once() [function.require]: Failed opening required './wp-load.php' (include_path='.:/opt/local/lib/php') in ./admin.php on line 20
So I did some more testing to find out the error is related to when a file is included using a ‘.’ path i.e. require_once('./admin.php'); such as on line 10 of wp-admin/index.php.
If I rewrite this line as require_once(dirname(__FILE__).'/admin.php'); we get past this error. But files all over WordPress are included like this and so this IS NOT A WORK AROUND.
I need to understand what could be the reason dirname() is not working when a file is included using a dot path such as ‘./admin.php’.
Some tests inserted inside admin.php and called from wp-admin/index.php:
test: echo(__FILE__);
output: ./admin.php
test: echo(dirname(__FILE__));
output: .
test: echo(dirname(dirname(__FILE__)));
output: .
But if I rewrite line 10 of wp-admin/index.php from require_once('./admin.php'); to require_once(dirname(__FILE__).'/admin.php'); and rerun the same tests inserted inside admin.php and called from wp-admin/index.php:
test: echo(__FILE__);
output: /home/domainname.com/web/public/wp-admin/admin.php
test: echo(dirname(__FILE__));
output: /home/domainname.com/web/public/wp-admin
test: echo(dirname(dirname(__FILE__)));
output: /home/domainname.com/web/public
Don’t edit core files! And try using the full path from document root for includes.
Thanks esmi. This problem concerns core files which call includes without using a full path. I certainly do not want to edit them but they were recently rewritten by WordPress in a way which is causing problems in my environment. I’m guessing most servers are not having this problem with WordPress core files.
Maybe someone can tell me what setting of PHP or Apache may be causing this strange behavior. I run a Joyent SmartMachine with root access and the following details:
System hostname somehost.joyent.us
Operating system Sun Solaris 11
Webmin version 1.430
Virtualmin version 3.63.gpl (GPL)
Theme version 6.3
Time on server 11/Jan/2011 15:26
Kernel and CPU SunOS 5.11 on i86pc
php -v
PHP 5.2.6 (cli) (built: Aug 5 2008 17:17:13)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Has anyone found a correction to this error? I just went through the 5-minute install, and I am getting this error when I try to go to my http://mydomain.com/blog
Here is the error:
Warning: require_once(/www/zavosarc/public_html/admin.php) [function.require-once]: failed to open stream: No such file or directory in /www/zavosarc/public_html/blog/admin.php on line 12
Fatal error: require_once() [function.require]: Failed opening required ‘/www/zavosarc/public_html/admin.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /www/zavosarc/public_html/blog/admin.php on line 12
No luck. I just created a new virtual website and deployed there. It’s also not a problem on my new Joyent SmartMachine (I now have two).