|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-11 10:38 UTC] sunseb at live dot com
Description:
------------
php.ini :
open_basedir = /home/
directory :
/home/my_file.txt
script :
is_file('/home/my_file.txt'); // TRUE.
is_file('/home/my_file.txt/whatever'); // FALSE but "Warning: is_file():
open_basedir restriction in effect." Why this warning (open_basedir is OK) ?
Thank you ! (And sorry for my english.)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
I setup my machine as described in this bug and changed my /etc/php.ini so that open_basedir = /home/, mkdir /home/my_file.txt and did a touch /home/my_file.txt/whatever. I then ran this script <?php var_dump (is_file("/home/my_file.txt")); var_dump (is_file("/home/my_file.txt/whatever")); ?> and got this bool(false) bool(true) Is there another change I need to make to php.ini or something I'm missing?Still occurs in PHP 5.3.6. to replicate: <?php error_reporting(E_ALL); ini_set('display_errors', 1); echo 'testing open basedir problems <br />'; // append text to current directory name which should be the dir of open_basedir to trigger open_basedir warning echo 'checking ' . dirname(__FILE__) . 'test <br />'; var_dump(file_exists(dirname(__FILE__) . 'test')); // no warning should occur here whether index.php exists or not echo 'checking ' . dirname(__FILE__) . '/index.php <br />'; var_dump(file_exists(dirname(__FILE__) . '/index.php')); // if index.php exists a open_basedir warning will be thrown echo 'checking ' . dirname(__FILE__) . '/index.php/test <br />'; var_dump(file_exists(dirname(__FILE__) . '/index.php/test'));Still reproduced on 5.4.17.20130704: Still said about open_basedir restriction when checking the path contains real file instead dir in the middle of the path. is_file('/home/my_file.txt/file'); where /home/my_file.txt is a real file.