|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22475 Include() not limited in safe mode
Submitted: 2003-02-28 07:17 UTC Modified: 2003-03-09 19:19 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: oliver at summertime dot net Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: oliver at summertime dot net
New email:
PHP Version: OS:


 [2003-02-28 07:17 UTC] oliver at summertime dot net

in PHP 4.2.2 I get the following error when I want to include '/etc/passwd':

Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /etc/passwd owned by uid 0 in /home/httpd/htdocs/i.php on line 4

Warning: Failed opening '/etc/passwd' for inclusion (include_path='.:/usr/local/lib/php') in /home/httpd/htdocs/i.php on line 4

I just upgraded to PHP 4.3.0 and the file will be included without any error message!

readfile() performs right:

Warning: readfile() [function.readfile]: SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /etc/passwd owned by uid 0 in /home/httpd/htdocs/i.php on line 4

Warning: readfile(/etc/passwd) [function.readfile]: failed to create stream: Inappropriate ioctl for device in /home/httpd/htdocs/i.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-28 11:00 UTC]
Please try using this CVS snapshot:
For Windows:

Unable to replicate with latest CVS.
 [2003-03-09 19:19 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2007-09-07 18:17 UTC] ltworf at galileo dot dmi dot unict dot it
I am using PHP Version 4.4.4-8+etch4 and i am experiencing a similar 
When i open a file with readfile(), safe mode doesn't allow me to 
open the file only if it is contained in a directory with a 
different UID.
If the script and the file to open are owned by different users but 
are located in the same directory, or the file to open is located in 
a directory owned by the same user of the script, i'll be able to 
read the file.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Mar 08 22:01:23 2021 UTC