Vagrant, Symfony and Windows are not incompatibles
At work, I’m using Vagrant on my Windows 10 because Docker really sucks on windows :(
So after promoting PuPHPet, I’m now using
Scotch Box.
In a few words, this is some features already in this box:
- Ubuntu 14.04 LTS (Trusty Tahr)
- PHP 5.6
- Ruby 2.2.x
- MySQL, PostreSQL, SQLite, MongoDB
- Redis, Memcache, Memcached
- Vim, Git, cURL, Composer, Node, NPM, Mailcatcher, Bower, Grunt…
- …
It is a good base.
For my needs, I pimp this box (take a look on
my fork (on GitHub)). I found it pretty cool on my linux…
but on my Windows, it’s really SLOW!
Before: running a Symfony app into a Vagrant box
Here is some tip’s to speed up your application.
First step: Install plugins
-
Install VirtualBox Guest plugin
-
Install Vagrant WinNFSd plugin
I don’t reinvent the wheel here. If you type speed up vagrant on windows
you will see the same
results.
With this config I switch from ~16s to ~4s for a page to load.
Second step: Install PHP7
In my case PHP7 really decrease page loading time. Be careful, installing PHP7 will remove php5.
1. Update package list
2. Install PHP7 and remove PHP5
3. Set timezone (i.e. date.timezone = Europe/Paris)
4. Restart apache service
Now my app run in ~2s.
Third step: Don’t sync cache/log folders with your windows host!
On Benjamin Eberlei’s blog, I found this last tip: put yours logs and cache on non-shared folders.
If you need, here is some aliases to help you.
And… tadaaaa! It took Some hundred milliseconds ♥ (I also added some SQL requests to MySQL… just for fun).
After: running a Symfony app into a Vagrant box
About the author
Hey, I'm Maxence Poutord, a passionate software engineer. In my day-to-day job, I'm working as a senior front-end engineer at Orderfox. When I'm not working, you can find me travelling the world or cooking.
Follow @_maxpou