php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48778 Files on NTFS Mounted Volumes (Junctions) inaccessible
Submitted: 2009-07-02 15:18 UTC Modified: 2010-10-20 11:29 UTC
Votes:18
Avg. Score:4.9 ± 0.3
Reproduced:17 of 17 (100.0%)
Same Version:17 (100.0%)
Same OS:11 (64.7%)
From: cs at koch-aplsystems dot de Assigned: pajoye (profile)
Status: Not a bug Package: *General Issues
PHP Version: 5.3.0 OS: win32 only - XP SP3
Private report: No CVE-ID: None
 [2009-07-02 15:18 UTC] cs at koch-aplsystems dot de
Description:
------------
Apache 2.2 DocumentRoot is on a NTFS drive with a Mounted Volume (NTFS Junction) Partition. All files the seem inaccessible to PHP 5.3.x (5.2.x version do not show this problem)

Changing Apache DocumentRoot to a "real" directory on c: works around the problem.


Reproduce code:
---------------
not needed

Expected result:
----------------
php script loading

Actual result:
--------------
Fatal error: Unknown: Failed opening required 'C:/Web/apache-root/my_file.php' (include_path='.') in Unknown on line 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-09 20:38 UTC] Steve at b-en-e dot com
Confirmed here. 5.2.8 does not have this problem, but 5.2.10 does, so it was introduced in the previous versions.

Removing the junction from the picture solves the problem.

Note that it is not only the source files: if the error log is directed to a junctioned folder apache ends the request with a connection reset by peer.
 [2009-07-20 20:33 UTC] phpstuff at cresstone dot com
Reproduced, some things seem ok on previous versions.

Where the NTFS folder 'c:\mnt\drive1' is a mounted drive... 

Using 5.3, is_dir('c:\mnt\drive1') returns false, and other filesystem functions like scandir fail. However, using the 5.2.10 zip package, is_dir returns true and scandir correctory enumerates the directory.
 [2009-08-09 16:20 UTC] tswsl1989 at sucs dot org
Problem also occurs when trying to access a junction contained within the DocumentRoot of Apache.

Apache/2.2.11 (Win32) PHP/5.3.0 
NTFS 3.1 on both drives.

Error occurs accessing <docroot>\igal, where <docroot>\igal is a junction to O:\
 [2009-08-10 15:33 UTC] pajoye@php.net
Can you using CLI or FastCGI please?

Using:
F:\wc63>dir c:\temp\
10.08.2009  17:30    <JUNCTION>     foo [f:\]

and this call:

php-cgi.exe c:\temp\foo\wc63\http\pwe\t.php

it works just fine (CLI/FCGI).

It could be an apache only problem.
 [2009-08-10 20:56 UTC] mats dot lindh at gmail dot com
(If the formatting of this comment gets fubared, I've created a copy online: http://e-mats.org/resources/php-5.3-windows-junctions.txt)

Here's a simple test opening a file in PHP instead (I'm guessing that the first open file in the php binary ignores stuff such as streams, etc. and uses another codepath):

test.php
========

<?php
var_dump(file_get_contents("testcase-junction/test.txt"));
var_dump(file_get_contents("testcase/test.txt"));

With a snapshot downloaded today vs PHP 5.2.5 (from WAMP, which was the only old installation I had around):

F:\temp\php-5.3-win32-VC9-x86-latest>php -v
PHP 5.3.1-dev (cli) (built: Aug 10 2009 19:52:21)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

F:\temp\php-5.3-win32-VC9-x86-latest>mkdir testcase

F:\temp\php-5.3-win32-VC9-x86-latest>cd testcase

F:\temp\php-5.3-win32-VC9-x86-latest\testcase>echo "This is a file" > test.txt

F:\temp\php-5.3-win32-VC9-x86-latest\testcase>cd ..

F:\temp\php-5.3-win32-VC9-x86-latest>junction testcase-junction testcase

Junction v1.05 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2007 Mark Russinovich
Systems Internals - http://www.sysinternals.com

Created: F:\temp\php-5.3-win32-VC9-x86-latest\testcase-junction
Targetted at: F:\temp\php-5.3-win32-VC9-x86-latest\testcase

F:\temp\php-5.3-win32-VC9-x86-latest>php test.php

Warning: file_get_contents(testcase-junction/test.txt): failed to open stream: No such file or directory in F:\temp\php-5.3-win32-VC9-x86-latest\test.php on line 2
bool(false)
string(19) ""This is a file"
"

F:\temp\php-5.3-win32-VC9-x86-latest>dir

[snip]
10.08.2009  22:40    <DIR>          testcase
10.08.2009  22:41    <JUNCTION>     testcase-junction



F:\temp\php5.2.5>php -v
PHP 5.2.5 (cli) (built: Nov  8 2007 23:18:51)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

F:\temp\php5.2.5>mkdir testcase

F:\temp\php5.2.5>cd testcase

F:\temp\php5.2.5\testcase>echo "This is a file" > test.txt

F:\temp\php5.2.5\testcase>cd ..

F:\temp\php5.2.5>junction testcase-junction testcase

Junction v1.05 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2007 Mark Russinovich
Systems Internals - http://www.sysinternals.com

Created: F:\temp\php5.2.5\testcase-junction
Targetted at: F:\temp\php5.2.5\testcase

F:\temp\php5.2.5>php test.php
string(19) ""This is a file"
"
string(19) ""This is a file"
"

F:\temp\php5.2.5>dir

[snip]
10.08.2009  22:46    <DIR>          testcase
10.08.2009  22:46    <JUNCTION>     testcase-junction

(This does not involve the DocumentRoot as in the first test case, and should hopefully be easier to isolate)
 [2009-08-15 20:39 UTC] php at cwdd dot info
I was getting these two warnings when switching from PHP4 to PHP5 on my setup (which included softlink / soft link / junction / junctions) on a wamp server:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'xxx' in Unknown on line 0

That was when I was trying to run 5.3.0. As previously mentioned, junctions work when using 5.2.8. After downgrading to 5.2.8 it immediately solved the problem (ps: for my setup I had to enable short tags)
 [2009-08-18 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".
 [2009-08-26 20:45 UTC] pajoye@php.net
Please follow #48746, same problem. I close (bogus) this bug to avoid to
have to split the info in too many reports.
 [2010-10-20 09:37 UTC] sarunas dot valaskevicius at oxid-esales dot com
we faced similar problem on linux, while mounting windows dir, which seems to be 
the same problem as bug#50150.

Also, the workaround to add parameter "-o noserverino" while mounting worked ok 
(maybe for windows there is a similar mounting feature?).
 [2010-10-20 11:29 UTC] pajoye@php.net
This bug is closed and all related discussion are now done in #48746. But it has nothing to do with Linux as the code related to this issue is windows specific.

If Linux has issues resolving junctions (or other file types), it is a samba or kernel problem, not php.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 12:01:27 2024 UTC