Running php files stored on OneDrive

独自空忆成欢 提交于 2019-12-04 22:54:54

问题


I am developing a php project, having the project files stored on OneDrive so that I can access them from anywhere.

I have set up XAMPP, with a VirtualHost pointing to my project folder inside OneDrive so that I can run it in my browser.

This has been working great up until yesterday, when OneDrive started crashing and I had to reinstall it. Now I'm no longer able to run php files stored on OneDrive.

I get this error in my browser:

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

Fatal error: Unknown: Failed opening required 'D:/OneDrive/MyProject/index.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0

My OneDrive folder is D:\OneDrive. If I set up a VirtualHost pointing to D:\, I am able to run files such as D:\index.php or D:\MyProject\index.php in my browser. But I'm not able to run files such as D:\OneDrive\index.php or D:\OneDrive\MyProject\index.php.

Does anyone have an idea what might cause this issue?

Edit:

The issue does not seem to be related to .htaccess, as the behavior is independent of whether a .htaccess file exists in the project folder or not.

Here is my VirtualHost, in case anyone is interested:

<VirtualHost *:80>
    ServerAdmin webmaster@myproject.com
    DocumentRoot "D:/OneDrive/MyProject/"
    ServerName myproject.com
    ServerAlias www.myproject.com 

    <Directory "D:/OneDrive/MyProject/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Require local
    </Directory>
</VirtualHost>

回答1:


I've not been able to solve the issue, but I've found a workaround:

  1. Store the project files outside of OneDrive.
  2. Make a symbolic link in the OneDrive folder to the project folder outside of OneDrive.

With this setup I'm able to run my PHP application, since the project files are not physically located in the OneDrive folder, and the project files are still uploaded and backed up on OneDrive due to the symbolic link.




回答2:


I think you just have to right-click OneDrive's icon in the Notification area, choose Settings > Settings > and uncheck Files on Demand.

Optionally, you can leave that, but just right click the folder in OneDrive that's giving you grief and choose the option to always keep a local copy of the folder.




回答3:


This bug is not fixed still. After Windows 10 May 2019 Update, the bug reappeared and it's not fixed by Microsoft.




回答4:


I think is fixed now (2018-11-26) - Now, sites are working again in OneDrive. I'm sure it was a OneDrive app problem that was fixed recently.



来源:https://stackoverflow.com/questions/47528273/running-php-files-stored-on-onedrive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!