include_path fatal error xampp

3 Answers

Make XAMPP/Apache serve file outside of htdocs

Ok, per pix0r's, Sparks' and Dave's answers it looks like there are three ways to do this:

Virtual Hosts

  1. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf.
  2. Un-comment line 19 (NameVirtualHost *:80).
  3. Add your virtual host (~line 36):

    <VirtualHost *:80>
        DocumentRoot C:\Projects\transitCalculator\trunk
        ServerName transitcalculator.localhost
        <Directory C:\Projects\transitCalculator\trunk>
            Order allow,deny
            Allow from all
  4. Open your hosts file (C:\Windows\System32\drivers\etc\hosts).

  5. Add transitcalculator.localhost #transitCalculator

    to the end of the file (before the Spybot - Search & Destroy stuff if you have that installed).

  6. Save (You might have to save it to the desktop, change the permissions on the old hosts file (right click > properties), and copy the new one into the directory over the old one (or rename the old one) if you are using Vista and have trouble).
  7. Restart Apache.

Now you can access that directory by browsing to http://transitcalculator.localhost/.

Make an Alias

  1. Starting ~line 200 of your http.conf file, copy everything between <Directory "C:/xampp/htdocs"> and </Directory> (~line 232) and paste it immediately below with C:/xampp/htdocs replaced with your desired directory (in this case C:/Projects) to give your server the correct permissions for the new directory.

  2. Find the <IfModule alias_module></IfModule> section (~line 300) and add

    Alias /transitCalculator "C:/Projects/transitCalculator/trunk"

    (or whatever is relevant to your desires) below the Alias comment block, inside the module tags.

Change your document root

  1. Edit ~line 176 in C:\xampp\apache\conf\httpd.conf; change DocumentRoot "C:/xampp/htdocs" to #DocumentRoot "C:/Projects" (or whatever you want).

  2. Edit ~line 203 to match your new location (in this case C:/Projects).


  • You have to use forward slashes "/" instead of back slashes "\".
  • Don't include the trailing "/" at the end.
  • restart your server.

I've installed Xampp 1.8.3 with the installer and I'm trying to move my htdocs folder from C:\xampp\htdocs to C:\Users\Håvard\htdocs. I've done the necessary edits to the httpd.conf file in xampp and Apache is starting, no problem there.

I've been struggling with this problem for a few days now, I even posted a question on it here earlier. Since then I've gotten a little bit further in my quest for a solutiion and I've come to the conclusion that this is a problem regarding the norwegian letter in my Windows-username (and therefore userfolder)

When I try to open my PHP project as localhost/project/index.php i get this message:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:/Users/Håvard/htdocs/project/index.php' (include_path='.;C:\xampp\php\pear\') in Unknown on line 0

The reason that I believe the norwegian letter is the reason for this message is that if I change the DocumentRoot and Directory in httpd.conf to anything else besides this folder (ex: C:/Users/Daniel) it works like a charm.

Why am I getting this error message? There is nothing wrong with my index.php as I've tried it with a different documentroot... Why is the "Håvard"-folder the problem? Is it the norwegian letter, or something else I have overlooked?

A VirtualHost would also work for this and may work better for you as you can host several projects without the need for subdirectories. Here's how you do it:

httpd.conf (or extra\httpd-vhosts.conf relative to httpd.conf. Trailing slashes "\" might cause it not to work):

NameVirtualHost *:80
# ...
<VirtualHost *:80>  
    DocumentRoot C:\projects\transitCalculator\trunk\
    ServerName transitcalculator.localhost
    <Directory C:\projects\transitCalculator\trunk\>  
        Order allow,deny  
        Allow from all  

HOSTS file (c:\windows\system32\drivers\etc\hosts usually):

# localhost entries localhost transitcalculator.localhost

Now restart XAMPP and you should be able to access http://transitcalculator.localhost/ and it will map straight to that directory.

This can be helpful if you're trying to replicate a production environment where you're developing a site that will sit on the root of a domain name. You can, for example, point to files with absolute paths that will carry over to the server:

<img src="/images/logo.png" alt="My Logo" />

whereas in an environment using aliases or subdirectories, you'd need keep track of exactly where the "images" directory was relative to the current file.

I found a solution to the problem. It was the encoding of the httpd.conf file. Here's what I did (I guess there's several ways to do this):

  1. Open httpd.conf in Notepad++
  2. Change Notepad++ settings in the section 'New Document' to UTF-8
  3. Create new document
  4. Copy and paste everything from httpd.conf to the new docuement
  5. Save and overwrite as httpd.conf

This answers my question, but it didn't solve my overall issue of the norwegian letter causing problems with my xampp installation. Here's the next problem I faced.