?
Solved

wp-blog-header.php not found

Posted on 2016-08-16
6
Medium Priority
?
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 84

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 84

Accepted Solution

by:
Dave Baldwin earned 1000 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
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

 
LVL 7

Assisted Solution

by:David Sankovsky
David Sankovsky earned 1000 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 84

Expert Comment

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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

765 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