php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50841 file_exists() causes open basedir warning when not under server doc root
Submitted: 2010-01-26 07:07 UTC Modified: 2013-02-18 00:34 UTC
From: paul dot sanchez at basicdays dot com Assigned:
Status: No Feedback Package: Safe Mode/open_basedir
PHP Version: 5.3.2RC1 OS: win32 only - Windows 7
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: paul dot sanchez at basicdays dot com
New email:
PHP Version: OS:

 

 [2010-01-26 07:07 UTC] paul dot sanchez at basicdays dot com
Description:
------------
- Using the VC9 x86 Non Thread Safe 5.3.1 version and the 5.3.2RC1 version from windows.php.net
- IIS7 using fast cgi
- Script works when under C:\inetpub\wwwroot
- Script gives warning when it is running under a virtual directory or application
- Problem does not exist when open_basedir is not set
- Following are some php.ini settings from development ini file
  - cgi.force_redirect = 0
  - cgi.fix_pathinfo = 1
  - fastcgi.impersonate = 1
  - fastcgi.logging = 0

Reproduce code:
---------------
<?php
$root = dirname(__FILE__);
echo $root;
echo 'phpinfo.php: ' . file_exists('test.php') . '<br>';
echo 'junk.php: ' . file_exists('junk.php') . '<br><br>';

echo 'phpinfo.php: ' . file_exists("$root/test.php") . '<br>';
echo 'junk.php: ' . file_exists("$root/junk.php") . '<br><br>';
?>

Expected result:
----------------
C:\Users\myname\WIP\myproject

test.php: 1
junk.php:

test.php: 1
junk.php:

Actual result:
--------------
C:\Users\myname\WIP\myproject

test.php: 1

Warning: file_exists() [function.file-exists.php]: open_basedir restriction in effect. File(junk.php) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Users\myname\WIP) in C:\Users\myname\WIP\myproject\test.php on line 5
junk.php:

test.php: 1

Warning: file_exists() [function.file-exists.php]: open_basedir restriction in effect. File(C:\Users\myname\WIP\myproject/junk.php) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Users\myname\WIP) in C:\Users\myname\WIP\myproject\test.php on line 8
junk.php:

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-26 07:29 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-01-27 01:56 UTC] pajoye@php.net
What's the value of open basedir?
 [2010-01-27 03:30 UTC] paul dot sanchez at basicdays dot com
Hi jani:
There does not seem to be a compiled snapshot for windows posted on windows.php.net at this time. I tried to compile php5.3-latest.tar.gz
myself, however I can't seem to get nmake to finish successfully at this time. The Visual Studio compilers, bison, and flex were successfully found.

Hi pajoye:
Open basedir is set to
open_basedir = "C:\inetpub\wwwroot;C:\Users\myname\WIP"

Thanks for your guys' responses.
 [2010-02-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-25 20:24 UTC] felipe@php.net
-Status: No Feedback +Status: Feedback
 [2010-04-25 20:24 UTC] felipe@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC