VM + Vagrant vs XAMPP vs WAMP (manual) vs LAMP (manual)

There is a lot more for using a VM to develop on.

  1. You can set up pretty much the same system as the production server. So your environment is a lot more efficient in terms of doing the right things for the right system, the first time. A golden rule for quality. Following this rule is practically impossible with XAMMP or WAMP, because you don’t run a Windows server on your Windows computer (usually).

  2. Almost every question asked on the Internet is asked for the LAMP stack or rather for Linux environments. So, if you are on XAMMP or WAMP, and you find something that sounds like a solution for your problem, the solution given might not, and often won’t, match for your system. Then you are left on your own to figure out how to use the answer for your system. This wastes time.

  3. Learning is much easier for Linux based systems, because practically every tutorial out there is based off of some variant of Linux. Windows is hardly ever used for learning tutorials.

  4. The software you can acquire to run on an application server stack (like LAMP) is often also offered as a Windows version. However, in my experience, Windows often causes more exotic issues and these issues are usually ignored or are pushed back in order to tackle higher priority Linux issues. So, being a pure Windows user is a disadvantage in this respect.

  5. The virus thing is hardly a consideration for using a VM. At least I’ve never heard it before and I rarely consider it. But, for sure, your host system is a lot safer, if you are downloading stuff out of the Internet onto the VM. One should just avoid using shared files between the host and guest. It takes only about 1-2 minutes to set up SFTP for deployment of code to the dev VM.

  6. On the PHP5.4 thing you mention as a bad for using Puphpet. It is an additional step, but there is nothing to stop you from removing the PHP version Puphpet/Vagrant installed and installing an older version. But, why would you do that? If you have legacy code in production running on anything under 5.5, you should be getting it up to 5.5 or higher. If you are developing something new, you should very much be programming it for 5.6 or even better PHP7. Although, the PHP devs have extended support for 5.6, I still think every dev, if they can, should be developing for PHP7.

  7. You touched a bit on the dispensibleness of the VMs. I’d like to emphasize this a bit more. If you screw up a VM, you can destroy it and start over. It takes all of about 10 minutes (automated, so you can go get a cup of coffee and do some surfing on the Internet, while you wait) to rebuild a new box. If you screw up your own computer, getting it back into a functional state could be a really frustrating ordeal and it will usually take a whole lot longer than 10 minutes, even if you are absolutely certain about what you are doing. If you aren’t absolutely certain, it could be you are doing more damage than good. So, from this perspective, a Vagrant box is a much, much better solution for beginners to work on, actually.

  8. You can set up multiple environments. Let’s say one project is on Ubuntu with PHP7 and Maria DB using Apache as the web server and another is with CentOS, PHP5.6 and MongoDB with Nginx as the web server. Let’s say you need a third with Debian and want to try out Caddy. With VMs, you could theoretically develop for the first two and try out the third all in parallel, if you wanted to. That might not be really feasible, but the point is, you can fire up different non-conflicting environments very easily, for each project you have. This is also impossible with Xammp and very unpractical with Wamp.

I will admit, using Virtual box and Vagrant has a bit of learning curve. Puphpet.com lowers that learning curve a lot. I would suggest to any PHP developer to use VMs as a development environment, especially beginners. There are way more positives for using VMs and only the learning curve as a negative in my book.

Scott

2 Likes