|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
20 - 5 = ?
Subscribe to this entry?

 [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-2019 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 08:01:25 2019 UTC