|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-09-29 07:45 UTC] info at xboot dot de
Description:
------------
System:
Win 2003 SP1
IIS 6
PHP 5.2.0RC5-dev (29.09.2006)
File operations with slash at the beginning (absolute path) don't work. It doesn't matter which kind of function i use. include(), fopen(), SPL-functions, ... don't work if i pass a filename with a slash at the beginning. If i add the drive letter it works correct.
The same script works fine with PHP 5.1.2.
Reproduce code:
---------------
<?php
echo $_SERVER['PHP_SELF'] . '<br />';
$handle = fopen($_SERVER['PHP_SELF'], "r");
// this is the same file, but it works:
// $handle = fopen("D:\Intranet\path.php", "r");
echo $handle;
?>
Expected result:
----------------
Result with PHP 5.1.2:
/intranet/path.php
Resource id #2
Actual result:
--------------
Result with PHP Version 5.2.0RC5-dev (29.09.2006):
/intranet/path.php
Warning: fopen(/intranet/path.php) [function.fopen]: failed to open stream: No such file or directory in D:\Intranet\path.php on line 5
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
With the CLI version, if you are in the root of the drive when the script is run then the file is found. <?php // C:\boot.ini echo file_get_contents('/boot.ini'); // D:\system.pas echo file_get_contents('/system.pas'); ?> If in C:\, then boot.ini is found. If in my C:\BATCH directory then it is not. According to System Internals FileMon.exe, filtering boot.ini;system.pas results in ... 14:56:56 php.exe:2004 IRP_MJ_DIRECTORY_CONTROL C:\BATCH\ NO SUCH FILE FileBothDirectoryInformation: boot.ini 14:56:56 php.exe:2004 IRP_MJ_CREATE C:\BATCH\boot.ini NOT FOUND Options: Open Access: All 14:56:56 php.exe:2004 IRP_MJ_DIRECTORY_CONTROL C:\BATCH\ NO SUCH FILE FileBothDirectoryInformation: system.pas 14:56:56 php.exe:2004 IRP_MJ_CREATE C:\BATCH\system.pas NOT FOUND Options: Open Access: All This removes the issue as relating to ISAPI only (i.e. it is not the webserver getting in the way). Using php -n at the cli removes any issue with ini file settings.