[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

wp-blog-header.php not found

Posted on 2016-08-16
6
Medium Priority
?
262 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
Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

 
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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

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

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.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
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

650 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