|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2003-04-13 23:19 UTC] pollita@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 06:00:01 2025 UTC | 
file_exists gives a misleading error message if open_basedir is in effect. Example: <?php error_reporting(E_ALL); # We have: # open_basedir = /var/www/htdocs/site-com-prod:/var/www/htdocs/site-com-test:/usr/local/phpwiki // get $filename from parameters if (file_exists($filename)) { print "The file $filename exists"; } else { print "The file $filename does not exist"; } ?> Results: The following give no problem, just the 'does not exist' result: $filename = '/var/www/htdocs/site-com-prod/i_dont_exist.txt'; $filename = '/var/www/htdocs/site-com-test/i_dont_exist.txt'; $filename = '/usr/local/phpwiki-1.3.4'; Now we try something outsid of the open_basedir path set: $filename = '/etc/passwd'; We get: PHP Warning: file_exists() [<a href='http://www.php.net/function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/etc/passwd) is not within the allowed path(s): (/var/www/htdocs/site-com-prod) in /usr/local/phpwiki-1.3.4/test.php on line 12 Clearly, the open_basedir path indicated by file_exists() in this error message is wrong & confusing.