Solved

wp-blog-header.php not found

Posted on 2016-08-16
6
67 Views
Last Modified: 2016-08-17
I've written a PHP file that I use as a template for a WordPress page and  I want to refer to some WordPress functions on the page so at the top I have:
require_once("/nas/wp/www/bb2/wp-blog-header.php");
 global $wpdb;

Open in new window


"/nas/wp/www/bb2/"  is the root of my site and I can clearly see that wp-blog-header.php is there in the root:
Site root
Yet, when the PHP file runs it throws the error:

              Warning: require_once(/nas/wp/www/bb2/wp-blog-header.php):  failed to open stream: No such file or directory . . .

Why doesn't it see wp-blog-header.php?

I have a staging copy of the site (the site is hosted on WP Engine, where it's easy to create staging sites) and it works there!  The only difference is that I included "staging" in the path to wp-blog-header.php:

 require_once("/nas/wp/www/staging/bb2/wp-blog-header.php");
 global $wpdb;

Open in new window


Does anyone have any idea what could be going on?  After half a day looking at this, I'm out of ideas.

Thanks
0
Comment
Question by:steva
  • 3
  • 2
6 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41758823
Where is the page that is 'including' that file?
0
 

Author Comment

by:steva
ID: 41758836
The php file that has the "require()" is a bit large (750 lines) to include here but I can tell you it's a direct copy of the file in the staging version of the site - that works - except the staging copy has "staging" in the require path.  I copied the staging version and then deleted "staging" from the require path to get the live version, that doesn't work.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 41758903
I didn't want to see it, I wanted to know what directory it is in.  Looks to me like it should probably be just...
require_once("wp-blog-header.php");

Open in new window

1
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Assisted Solution

by:David Sankovsky
David Sankovsky earned 250 total points
ID: 41758911
First of Dave might have a good point.
Also, I'd check the ownership and the permissions on the file in question.
0
 

Author Comment

by:steva
ID: 41759281
I found the problem.  phpinfo() shows that the document root for the live site is

/nas/wp/www/sites/bb2

Open in new window

not
/nas/wp/www/bb2

Open in new window

require_once("/nas/wp/www/sites/bb2/wp-blog-header.php"); 

Open in new window

works.
Thanks for your input.  I split the points.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41759783
You're welcome, glad to help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
what is best version of php to use 6 44
Site hacked - decoding the PHP? 15 57
Hacked File Timestamps 4 49
Form Processing in PHP 11 30
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now