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
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.