Bite my bytes

What I learn by day I blog at night - A blog from Microsoft Consultant working from Ljubljana, Slovenia

  Home :: Contact :: Syndication  
  999 Posts :: 7691 Comments :: 235 Trackbacks

Search

Most popular posts
in last 30 days

Categories

My Projects

Archives

Stuff


Copyright © by David Vidmar
 
Contact me!
 
LinkedIn Profile
 
 
 

 Installing and hosting WordPress on Windows is plain simple. Just follow one of many PHP installation guides, install MySQL, download and extract WordPress and you are done.

Well, except when dreaded "Failed opening required './wp-blog-header.php'" error occurs. That's where fun stops.

Warning: main(./wp-blog-header.php) [function.main]: failed to create stream: No such file or directory in D:\WWW\somewebsite\index.php on line 3

Fatal error: main() [function.main]: Failed opening required './wp-blog-header.php' (include_path='.;c:\php4\pear') in D:\WWW\somewebsite\index.php on line 3

WordPressI have been searching for a solution for some time and found nothing that would work every time. Most of the time IIS is to blame and changing the source code is just not a viable solution.

This is how I worked around the problem and it seems to work great:

1) Don't install WP in the root of your domain like http://nauticalinks.com. Use a directory like http://nauticalinks.com/blog.

2) Create automatic redirection from root to /blog.

You can do that using JavaScript. Just put following in default.htm in the root:

<HEAD>
<SCRIPT language="JavaScript">
<!--
window.location=http://someplace.com/blog;
//-->
</SCRIPT>
</HEAD>

    But since I had a site in root and Google indexed it and there are probably some link to there which I don't want to loose I wrote my first and second PHP line of code instead of JavaScript above:

    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: /blog".$_SERVER['REQUEST_URI']);
    ?>

    This will permanently redirect every request to same request with /blog inserted in URL.

    I did that about a month ago and Google picked it up nicely. Whole index is still there but updated to new URLs.

    PS: This is actually my first and second PHP line in my life, I wasn't kidding. If you know a better way to accomplished what I tried to do, please let me know in the comments!

    Posted on Sunday, July 29, 2007 10:07 PM | Filed under: Software Blogging Internet |

    Feedback

    # re: WordPress error "Failed opening required './wp-blog-header.php" 7/30/2007 11:47 AM StefanB
    It's a pitty IIS can't do what seems to be quite normal in Apache using mod rewrite to rewrite URLs into desired way.

    # re: WordPress error "Failed opening required './wp-blog-header.php" 9/20/2007 6:55 PM dave
    Sure thats one way to look at it. Another is why would you have a document in your root directory with a relative reference to the parent of the current directory? The parent of the root is kinda a contradiction don't you think?

    Unless of course thats a hack to enable url rewrites sort of like using 404 handling in iis6 to accomplish url re-writes which is easily done.


    # re: WordPress error "Failed opening required './wp-blog-header.php" 9/14/2008 4:42 AM Foong
    Can I ask where place the php code below?
    Inside default.htm at root?

    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: /blog".$_SERVER['REQUEST_URI']);
    ?>

    # re: WordPress error "Failed opening required './wp-blog-header.php" 2/24/2009 10:56 AM jojo
    I want to install fresh wordpres 2.7.1. After extracting the source (download from wordpress.org), I setup wp-config.php file. And then running wp-admin/install.php.

    I got the warning message like this. I inspecting the source code and I found a line pointing to ./wp-blog-header.php

    But I can't find where is the file is. Even I search into sub directories.

    Anybody can help me?
    thanks before.


    # re: WordPress error "Failed opening required './wp-blog-header.php" 2/24/2009 5:33 PM jojo
    oops. It's ok after re-download the corrupted source.

    # re: WordPress error "Failed opening required './wp-blog-header.php" 7/18/2009 9:13 PM imam ciptarjo
    very helpful ...

    I also have a web site having problems online 1045 ...

    but can be overcame ...

    thank you ...

    do not forget to visit the it.alonearea.com

    # re: WordPress error "Failed opening required './wp-blog-header.php" 8/25/2009 11:39 AM Crazy blogger
    i too had the same problem in header.php

    # re: WordPress error "Failed opening required './wp-blog-header.php" 3/11/2010 2:23 AM Ryan Wilmot
    You can manually fix this by making a tiny edit to Line 17 of your index.php

    Line 17 will look like this:
    require('./wp-blog-header.php');

    Take out the ./ so it looks like this:

    require('wp-blog-header.php');

    This corrects the path issue in windows, so that you can have Wordpress as a root domain. Good luck!


    # re: WordPress error "Failed opening required './wp-blog-header.php" 6/4/2010 4:34 AM Dan
    This worked for me, thanks a lot!!!

    Comments have been closed on this topic.