Connecting Tech Pros Worldwide Help | Site Map

include and require not working with ./ in Windows

Dan Fulbright
Guest
 
Posts: n/a
#1: Nov 29 '05
I'm using PHP 5.0.5 as an ISAPI module on IIS 6, Windows Server 2003.

Files specified by include() or require() don't get included if the
filename begins with ./ (dot slash). phpMyAdmin uses this convention,
as I'm sure many other applications do. This works fine on several
other servers that I administer, although they are using PHP 4 as CGI.

Here's how I am reproducing the problem.

I have a file, includetest.php:

<?php
echo "include_path = " . get_include_path() . "<br />\n";
echo "Here is ./include.inc.php:<br />\n";
include('./include.inc.php');
echo "Here is include.inc.php:<br />\n";
include('include.inc.php');
?>

Here is include.inc.php, which is in the same directory:

This is the contents of include.inc.php<br />

Here are the results of running the script through PHP:

include_path = .;D:\PHP5\includes
Here is ./include.inc.php:

Warning: main(./include.inc.php) [function.main]: failed to open
stream: No such file or directory in c:\inetpub\wwwroot\includetest.php
on line 4

Warning: main() [function.include]: Failed opening './include.inc.php'
for inclusion (include_path='.;D:\PHP5\includes') in
c:\inetpub\wwwroot\includetest.php on line 4
Here is include.inc.php:
This is the contents of include.inc.php


As you can see, if I take the ./ away from the path it works fine.

Closed Thread