Solved

wp-blog-header.php not found

Posted on 2016-08-16
6
55 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 82

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 82

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 6

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 82

Expert Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

705 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