php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37907 problem with open_basedir restriction
Submitted: 2006-06-25 10:39 UTC Modified: 2006-06-29 14:38 UTC
From: sreniaw at wp dot pl Assigned:
Status: Closed Package: Safe Mode/open_basedir
PHP Version: 5.1.4 OS: Solaris
Private report: No CVE-ID: None
 [2006-06-25 10:39 UTC] sreniaw at wp dot pl
Description:
------------
I have configured php'a open_basedir for directory /wwwroot/default in httpd.conf.

open_basedir = /wwwroot/default

/wwwroot/default
       -test.txt
       -test.php
I've tryied to read test.txt file, but I can not do it
baceuse of open_basedir restriction.

Reproduce code:
---------------
<?php
 readfile("test.txt");
?>

Expected result:
----------------
Read file test.txt

Actual result:
--------------
Warning: readfile() [function.readfile]: open_basedir restriction in effect. File(test.txt) is not within the allowed path(s): (/wwwroot/default) in /wwwroot/default/test.php on line 2

Warning: readfile(test.txt) [function.readfile]: failed to open stream: Not owner in /wwwroot/default/test.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-25 10:46 UTC] tony2001@php.net
Use absolute path or PHP will search file in the directory of the current script.
 [2006-06-25 12:26 UTC] sreniaw at wp dot pl
Is there any way to use open_basedir without absolute path ?
In my case reading file in the directory of the current script lead to open_basedir restriction.

open_basedir = /wwwroot/default
directory of the current script = /wwwroot/default
txt file I want to read is in = /wwwroot/default
I think that everything is ok. Why do I have this Warning ?
 [2006-06-29 14:38 UTC] sreniaw at wp dot pl
It has been solved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC