Troubleshooting WordPress Warning Require wp-blog-header.php Failed To Open Stream

August 11, 2010 · 10 comments

in Blogging

Warning Require wp-blog-header.php Failed To Open Stream

computer bug*Danger Will Robinson! Danger!*

If you’re not used to poking at the very guts of your host this post is not for you.

Infact its mostly just for me to document how I just corrected a issue on my VPS server tonight that may be affecting others.

99.99% odds that if you’re a regular reader of this blog, this post does not apply to you!

Okay so lets get down to the nuts and bolts!

Original Problem

It began with seeing a ton of these while doing: tail -f of the apache error logs. (Connecting to the VPS via putty)

On hostgator VPS that would be:

command: tail -f /usr/local/apache/logs/error_logs

[Wed Aug 11 02:43:32 2010]

[client 000.000.000.00] Premature end of script headers: index.php

So Bobby keenly suggested I run php against index.php and find out why it was dying.

Testing PHP on index.php Core WordPress File

command: php /home/username/public_html/index.php

Output:

Warning: require(./wp-blog-header.php): failed to open stream: No such file or directory in /home/username/public_html/index.php on line 17
Warning: require(./wp-blog-header.php): failed to open stream: No such file or directory in /home/username/public_html/index.php on line 17
Fatal error: require(): Failed opening required ‘./wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/username/public_html/index.php on line 17

To this, Bobby replies: <bad pirate accent> Thar be yerr problem lass </bad pirate accent>

So Whats Up With wp-blog-header.php?

wp-blog-header.php is a core 3.0 file and contains

<?php   /** * Loads the WordPress environment and template. */

if ( !isset($wp_did_header) ) {
$wp_did_header = true;
require_once( dirname(__FILE__) . ‘/wp-load.php’ );
wp();
require_once( ABSPATH . WPINC . ‘/template-loader.php’ );
} ?>

So that didn’t prove useful.

More Head Scratching about wp-blog-header.php

So we speculated that perhaps the php was not configured to properly use relative paths on the host.

So I opened a copy of index.php.

Commented out:   /** require(‘./wp-blog-header.php’);  */

Added (right before php closing):  require(‘/home/username/public_html/wp-blog-header.php’);

Renamed old index.php to index-clean.php, then saved and uploaded the altered index.php copy.

Success!

That solved that error. The same error could also show up if the blog is appearing on yoururl.com but actually installed to /public_html/wordpress instead of in the root. Unfortunately any update that replaces index.php will require re-doing this.

I’m a little concerned about how many other things may be broke if the host isn’t handling the relative addressing correctly. I’ll contact them. However I didn’t see any other errors that appear related to that, so it may be a non-issue.

This issue was occuring (sorta) “silently” and not showing in the cpanel error logs. I was only seeing it from the VPS apache logs. It may be far more common than we know since so few people can look at those logs.

Here’s some related threads I found on this topic, simply for reference in case I didn’t include enough info here: Link 1, Link 2

This file or pathing is not new to 2.9.2 so I can not call it a wordpress bug, more like an issue at the host level. Since I own the VPS I can likely get this fixed. However, someone on shared hosting or even reseller hosting may not be able to so I’m providing this workaround.

That’s all folks! Hope it helps someone!

Happy WordPressing!
Kimberly

Subscribe To My Newsletter
social tripletKeep up with all the latest social marketing changes and news to accelerate your business!

  • WordPress, Facebook, Twitter, & Google+
  • Social Marketing
  • List Building & Affiliate Marketing


Previous post:

Next post: