PHP includes don't work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP includes don't work

Postby cannon_eer11 » 09. February 2006 11:53

Hi,
I just got the latest XAMPP, ran the setup batch file, and copied my website into the htdocs folder. When I tried accessing it through localhost, I got an include error.

This is the line causing the problem in my .php file (line 15):

Code: Select all
<?php include "\xampplite\htdocs\StudioC\titlebar.inc"; ?>


When I access the page, I get this error:

Code: Select all

Warning: include( mpplite\htdocs\StudioC itlebar.inc) [function.include]: failed to open stream: Invalid argument in H:\xampplite\htdocs\StudioC\Outdoor-Corrine\corrine.php on line 15

Warning: include() [function.include]: Failed opening ' mpplite\htdocs\StudioC itlebar.inc' for inclusion (include_path='.;H:\xampplite\php\pear\') in H:\xampplite\htdocs\StudioC\Outdoor-Corrine\corrine.php on line 15


It works fine on my commercial ISP's web server though.
Does anyone know what I'm doing wrong?[/code]
cannon_eer11
 
Posts: 2
Joined: 09. February 2006 11:49

Postby Wiedmann » 09. February 2006 12:08

This is the line causing the problem in my .php file (line 15):
Code: Select all
<?php include "\xampplite\htdocs\StudioC\titlebar.inc"; ?>

You must use forwardslashs:
Code: Select all
<?php include "/xampplite/htdocs/StudioC/titlebar.inc"; ?>
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby cannon_eer11 » 09. February 2006 14:09

Thanks, it worked.
But why is this so? It works fine with the other slashes on my commercial web server.
cannon_eer11
 
Posts: 2
Joined: 09. February 2006 11:49

Postby Wiedmann » 09. February 2006 15:47

Thanks, it worked. But why is this so?

http://de.php.net/manual/en/language.types.string.php
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 140 guests