|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19784 file_exists doesn't work
Submitted: 2002-10-06 14:59 UTC Modified: 2002-10-22 01:00 UTC
Avg. Score:4.4 ± 0.9
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:5 (83.3%)
From: m dot martinello at iol dot it Assigned:
Status: No Feedback Package: *Directory/Filesystem functions
PHP Version: 4.2.3 OS: Linux 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
30 - 15 = ?
Subscribe to this entry?

 [2002-10-06 14:59 UTC] m dot martinello at iol dot it
I am using php 4.2.3 with httpd 2.0.43.
The functions file_exists, is_file and file_size doesn't work at all.
file_exists("file.txt"); gives me "false" even if the file "file.txt" exists in the same directory of the script containing that function.
If I use the full path of "file.txt", file_exists("/full/path/to/file.txt"); gives me "true" and works well.

How to solve this problem? I can't use the full path in the scripts.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-06 14:59 UTC]
Please try using this CVS snapshot:
For Windows:
 [2002-10-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-06-26 15:37 UTC] mrueegg at metaworx dot ch
as to my experiance file_exists uses the current working directory [getcwd()] for relative path's and not the directory the script is in.

tested in v5.1.4 and 5.2-dev (26-Jun-2006 16:19)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 18 21:03:39 2021 UTC