#22065 [Opn->Fbk]: file() function
| From: | iliaa@php.net | Date: | Fri, 14 Feb 2003 02:37:21 +0000 |
| Subject: | #22065 [Opn->Fbk]: file() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33151@lists.php.net to get a copy of this message | ||
ID: 22065
Updated by: iliaa@php.net
Reported By: paul.d.rowlands@delphi.com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Windows 2000 server
PHP Version: 4.3.0
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2003-02-06 09:43:01] paul.d.rowlands@delphi.com
The file must exist to continue in the code:-
if(file_exists($file1)==FALSE) die("File1 does not exist");
The file is everybody full control.
What would have if the file was in use by another server (updating) ?
Can php detect this condition ?
------------------------------------------------------------------------
[2003-02-06 08:45:38] sniper@php.net
Does the file exist?
What are the permissions for it?
(I think it's is_readable() that does not work correctly
on windows)
------------------------------------------------------------------------
[2003-02-06 01:52:50] paul.d.rowlands@delphi.com
safe_mode = Off
;open_basedir =
------------------------------------------------------------------------
[2003-02-05 10:41:21] iliaa@php.net
Do you have open_basedir or safe_mode enabled?
------------------------------------------------------------------------
[2003-02-05 02:48:23] paul.d.rowlands@delphi.com
Error log fills with warnings abount the file() function.
Apache 2.0/34
Using php module version 4.3.0 rather than cgi.
Errors.log shows:-
[05-Feb-2003 08:33:45] PHP Warning: file(d:/temp/ht1/050203.ht1) [<a
href='http://www.php.net/function.file'>function.file</a>]:
failed to
create stream: Permission denied in d:\Apache
Group\Apache2\htdocs\fa_tools_ht.php on line 103
Code:-
if(file_exists($file1)==FALSE) die("File1 does not exist");
if(is_readable($file1)==FALSE) die("File1 not readable");
// parse files into arrays
$file_array1=file($file1); //WARNING HERE
if($file_array1==null) die("Permission denied to open file");
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22065&edit=1