Current path ./ not working with includes, PHP5 on Windows
Posted: Fri Jul 28, 2006 2:17 pm
I have just setup a PHP5/Apache server on Windows 2003. The install worked fine and PHP is running fine, as is Apache.
We are migrating from Linux to Windows. I have many, many files and even downloaded third-party applications and files that use the following method of including and requiring:
By all rights, this should include the file 'foo.php' that is located in the current directory, but it's not.
However, if I change the include to:
It works just fine. I expected it to work that way, but the problem is all my code is using ./ to denote the current directory, as is thirdparty stuff.
The 'path_include' in the php.ini is commented out, as it is by default. I've looked at theories elsewhere that suggest this is the problem, but nothing has worked, so I restored the php.ini to almost-default settings.
Beyond the include() function, other functions that work on files, like XSL functions, are also not finding files.
In this case, the 'collection.xml' file is in the same folder as the script running the function, but the function looks in the htdocs\ path for the file. Changing it to './collection.xml' doesn't work either.
I've spent most of the day trying to find a solution - or at least a definite answer that says using ./ will or will not work.
If anyone has any info or knows if ./ can be used on a Windows system, please reply.
I appreciate any and all comments on this topic.
Thanks,
~Brian, Ohio USA
We are migrating from Linux to Windows. I have many, many files and even downloaded third-party applications and files that use the following method of including and requiring:
Code: Select all
include("./foo.php");Code: Select all
Warning: include(./foo.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 3
Warning: include() [function.include]: Failed opening './foo.php' for inclusion (include_path='.;c:\php;c:\php\pear') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 3Code: Select all
include("foo.php");The 'path_include' in the php.ini is commented out, as it is by default. I've looked at theories elsewhere that suggest this is the problem, but nothing has worked, so I restored the php.ini to almost-default settings.
Beyond the include() function, other functions that work on files, like XSL functions, are also not finding files.
Code: Select all
$xml = new DOMDocument;
$xml->load('collection.xml');I've spent most of the day trying to find a solution - or at least a definite answer that says using ./ will or will not work.
If anyone has any info or knows if ./ can be used on a Windows system, please reply.
I appreciate any and all comments on this topic.
Thanks,
~Brian, Ohio USA