Solved

wp-blog-header.php not found

Posted on 2016-08-16
6
103 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 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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