php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26904 fopen() doesn't work with IIS "Anonymous Access"
Submitted: 2004-01-14 11:18 UTC Modified: 2004-01-14 11:34 UTC
From: bart at mediawave dot nl Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5CVS-2004-01-14 (dev) OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bart at mediawave dot nl
New email:
PHP Version: OS:

 

 [2004-01-14 11:18 UTC] bart at mediawave dot nl
Description:
------------
When I enable "Anonymous Access" in IIS, the filesystem functions in PHP5 suddenly aren't able to find my files. 

When I disable "Anonymous Access" (Only "Integrated Windows Authentication" enabled) everything works perfect.

I use PHP5 with HTTP authentication through the ISAPI DLL. I've given the IUSR_PCNAME account proper rights everywhere.

I've got "Anonymous Access" enabled on our production server and everything works fine there as well.

Reproduce code:
---------------
<?
$filename = "template.html";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);

echo $contents;
?>

Expected result:
----------------
The contents of template.html.

- or -

A message saying that I don't have permissions to read the file.

Actual result:
--------------
Warning: fopen(template.html) [function.fopen]: failed to open stream: No such file or directory in E:\WWW\agri-monitor\test2.php on line 6

Warning: filesize() [function.filesize]: stat failed for template.html in E:\WWW\agri-monitor\test2.php on line 7

Warning: fread(): supplied argument is not a valid stream resource in E:\WWW\agri-monitor\test2.php on line 7

Warning: fclose(): supplied argument is not a valid stream resource in E:\WWW\agri-monitor\test2.php on line 8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-14 11:34 UTC] wez@php.net
Not a PHP bug; you have a problem with your permissions
somewhere.
 [2004-01-22 03:11 UTC] miss18x at hotmail dot com
Hei,
I am facing the same problem when i am trying to open a file.
i have an a form where i am getting the userfile from and here is my code:
$filnavn=$_POST['file'];
$_FILES['userfile'] =$filnavn;
$file_open=fopen("$filnavn", "r"); 
if(!$file_open)
{
  echo "Cannot open file ($filnavn)";
  exit;
}
else
{
 echo "Fila ble ?pnet!<br>    ";
}

When i run this script it tells me,
Warning: fopen(C:\\Documents and Settings\\Administrator\\Skrivebord\\session.txt): failed to open stream: No such file or directory in c:\nyvedlegg.php on line 37

i know that u sayed it is a permission problem.
since i am new i would like to know if u tell me where i should go to do some changes.

tanx
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 15:01:34 2024 UTC