PHP Development – Addressing Lag Issues from Shared Sources

gitPHPvirtual machineweb-development

I have following development setup for my PHP projects:

  • Working station running on Windows 7 with PhpStorm IDE.
  • GIT for version controlling.
  • CentOS on virtual machine (VirtualBox) with Apache and MySQL (copy of production server).

So far, I've been sharing project's source folders between host and guest systems and it was working quite well only really slow. The reason behind this is that Apache was reading files from remote folder (mounted locally). After doing some research, I found out that this set up can be improved by using disk mapping (Samba) instead of folder sharing. So I did that change. I configured my PhpStorm to automatically deploy files to mapped drive. Everything works like a charm now, except for one problem – when I change branches I need to synchronize project's local folder with the one on mapped drive and that takes time, a lot of time (like branching in SVN). Is there another way to handle this than just working on files directly on mapped drive?

Best Answer

The most efficient setup for your configuration would be to git clone the repo via SSH directly into the virtual machine (in a location that's accessible to the SAMBA user), mount the "remote" folder from the VM as a network drive in Windows and use PHPStorm to open the project directly from that drive.

The point is this: edit the project directly from the mapped location, do not use PHPStorm's deployment options to deploy your changes to the mapped drive. It will still be slow, but it should be a bit faster than your current setup.

Related Topic