go to bug id or search bugs for
It would seem that the new "Files on Demand" feature of OneDrive in the Windows fall update causes issues with PHP's ability to open files. In theory according to MS this should be invisible to applications but there's definitely something screwy going on with PHP.
Any attempt to iterate through files in a folder, or even simply do a "require" results in PHP somehow not being able to see them. This applies even if the files are locally available on the PC, the only thing needed to trigger this is to have Files on Demand enabled and to have the source located somewhere within the OneDrive folder.
Moving the source code to any other folder makes things work normally.
Weirdly, PHP does seem to be able to read the initial file it's asked to execute, it's only secondary files it's unable to load.
This may or may not help debugging, but if I install Ubuntu into Windows 10 via the Windows Store, and execute PHP scripts in the OneDrive folder from Linux (so PHP is using the Linux file APIs, with the MS shim converting them to the Windows ones) then that works fine.
1) On a recent Windows Insider Build (or wait until RTM in a few days)
2) Enable OneDrive, and the "Files on Demand" feature
Then in your OneDrive folder, create 2 files
echo 'Require worked';
Then run php Foo.php
See "Require worked" output to the screen
PHP Warning: require(Bar.php): failed to open stream: No such file or directory
in Foo.php on line 2
Warning: require(Bar.php): failed to open stream: No such file or directory in F
oo.php on line 2
PHP Fatal error: require(): Failed opening required 'Bar.php' (include_path='.;
C:\php\pear') in Foo.php on line 2
Fatal error: require(): Failed opening required 'Bar.php' (include_path='.;C:\ph
p\pear') in Foo.php on line 2
Add a Patch
Add a Pull Request
I can confirm this issue.
The problem exist after upgrading Windows fall creators update 1709. I have upgraded 2 PC's to this version. On the first one, the Onedrive update (build 17.3.7073.1013) that supports the "Files on Demand" feature , is installed. On the second one, Onedrive (build 17.3.6998.0830) does not support the "Files on Demand" feature. On both the problem exists. This seems to suggest the cause of the problem is introduced by the Windows update, and is not depending on the Onedrive version.
I can also confirm that the problem does not exist on files that are not in a Onedrive directory.
I have added a comment on github on the code that might be the source of the problem: https://github.com/php/php-src/commit/065edced71c7f15f32fc2fb483a9048328b8108e#commitcomment-25110205
I think this is not OneDrive related. I moved htdocs to 1 directory above OneDrive (that is C:\users\username\htdocs) but still get the same error. When I move it to C:\htdocs - it works fine. I think there is something wrong with permissions, that PHP gets from Apache, even though, Apache can access the files normally. Tried setting php.exe to run under admin (Compatibility mode), but that did not help, either.
PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Only support that PHP can't access the file. And the funny thing is: if I look at the folders in Total Commander it shows them as... Links. And SymLink following is allowed in configuration file.
I figured out why it was not working for me when I moved htdocs. It was moved by Windows in a way, that Windows treated it as it was still in OneDrive. I ran
dir /AL c:\Users\username\
which is expected to show all "links" and it listed htdocs as "DIR". I moved it away, created a directory manually and reran the command: htdocs was not there. In both cases OneDrive was there as "DIR".
Note that /AL flag should NOT list "DIR". Meaning, that there is something different with those OneDrive directories (obviously). I dunno how to see what exactly.
BTW, the same thing affects MySQL: Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this optionFor more information, see Help and Support Center at http://www.mysql.com.
I've uploaded a test program here http://windows.php.net/downloads/snaps/ostc/75384/
Please download it and invoke on console like this
read_reparse_tag C:\Users\<my user>\OneDrive\
Then post the output.
On my computer the command execution result is this:
GetFileInformationByHandleEx: CreateFile failed
Hope that helps?
Although trying with a couple of folders within OneDrive, I have had a few different results come up too
I found that if I use the path "C:\Users\<my user>\OneDrive\" the result is what I posted earlier, that is:
GetFileInformationByHandleEx: CreateFile failed
while if I delete the last "\" making path "C:\Users\<my user>\OneDrive" the result is:
Thanks very much for a quick check, folks. It's indeed an incompatibility introduced with the version 1709. The issue is identified, a fix is under way.
Automatic comment on behalf of ab
Log: Fixed #75384 PHP seems incompatible with OneDrive files on demand
A fix for this has landed in the latest today's snapshots. Please check.
Yes, I can confirm that seems to have fixed it.
Thanks for checking! Since there are no other responses and the reporter signaled it's fixed, considering it as done. Further tests are welcome.
Sorry for the delay in responding, but I had had to move my files to another sharing system in order to continue development.
I have now had the chance to install the snapshot and move some files back to test and .... perfect!!
Thanks for the quick response.
@webmaster at baypatchers dot org dot uk, thanks for mentioning your test results anyway :)
Its fixed for me on Windows 10 Desktop.
FYI: The `Files On Demand` feature of OneDrive isn't supported on Windows Server.
FYI, looks like this bug still exists in the latest version for 7.0 (7.0.26), not sure if the patch has made it back to 7 yet?
Sorry, scratch that, I can see it in the snapshot only for 7.0, thought it had made it through to GA...