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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sreniaw at wp dot pl
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC