|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-05-14 23:35 UTC] bugs-php dot a2 at x25 dot pl
Description:
------------
open_basedir does not work as it should:
Test script:
---------------
<?
ini_set("open_basedir","/home/naox/public_html/test");
is_dir("/home/naox/public_html/test");
Actual result:
--------------
Warning: is_dir(): open_basedir restriction in effect. File(/home/naox/public_html/test) is not within the allowed path(s): (/home/naox/public_html/test/) in /home/naox/public_html/a.php on line 3
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 17:00:01 2025 UTC |
And how does it make not open_basedir problem? You are saying that I can't check if file/dir exists because it might not exist. Then how about mkdir()? or file_exists() or is_file()? mkdir() cant create directory because it also does not exist? cat a.php <? ini_set("open_basedir","/home/naox/public_html/test"); mkdir("/home/naox/public_html/test"); php a.php Warning: mkdir(): open_basedir restriction in effect. File(/home/naox/public_html/test) is not within the allowed path(s): (/home/naox/public_html/test) in /home/naox/public_html/naox.vipserv.org/a.php on line 3> And how does it make not open_basedir problem? You are saying that I can't check > if file/dir exists because it might not exist. I'll try again. open_basedir is not the problem. It works correctly. What does *not* work correctly is what PHP does when a file or directory does not exist. if (path_exists_and_is_inside_open_basedir($path)) { // (A) good: exists } else { if (open_basedir_is_enabled()) { // (B) bad: "open_basedir restriction in effect" // what if $path does not exist and is *inside* open_basedir! } else { // (C) good: does not exist } }