Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running php files stored on OneDrive

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 [email protected]
    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>
like image 736
Magnar Myrtveit Avatar asked Nov 28 '17 09:11

Magnar Myrtveit


2 Answers

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.

like image 89
Magnar Myrtveit Avatar answered Sep 26 '22 15:09

Magnar Myrtveit


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

like image 26
Dn Bianco Avatar answered Sep 24 '22 15:09

Dn Bianco