Vagrant in PhpStorm
Blogs20142014-03-13
Vagrant in PhpStorm - extend development environment
Vagrant(http://www.vagrantup.com/) is a very good PhpStorm add-on tool. It creates and configures lightweight, reproducible, and portable development environments.
The following are the steps of how to use Vagrant in PhpStorm, extend the Windows-based PhpStorm development environment into a full-stack LAMP environment.
- Download 64-bit Vagrant for Windows. Install this .msi file (144MB) locally to C:Vagrant
- Then in PhpStorm: Ctrl+Shift+A -> Vagrant: - Vagrant executable: C:Vagrantbinvagrant.exe - Add Vagrant Box: lucid32
- in current PhpStorm project, Tools -> Vagrant -> Init in Project Root: generate a ‘Vagrantfile’ file.
-
Modify the new generated Vagrantfile:
config.vm.synced_folder "./", "/vagrant_mvc"This way share the whole project ‘/mvc/’ into the VM Linux machine
- Tools -> Vagrant -> Up (Re)boot the VM machine and mounting shared folders
- Tools -> Start SSH session … To ssh to this Linux Ubuntu lucid32 VM for details. - cd /vagrant_mvc — same file structures as within PhpStorm. — edit any file to immediately effected PhpStorm, coz the files are shared.
- To add LAMP tools into the VM, there is a good repository site: https://puphpet.com. https://puphpet.com has whole packages can be used into the VM machine: - VM OS (CentOS, Ubuntu, Debian - Server Packages - Webservers - Languages - Databases - etc By choose the defaults step by step to generate the Vagrant file and puphpet/ folder, copy them into PhpStorm’s current mvc/ directory, Reload the VM, all the LAMP-stack is download and installed. Very cool.
- This way creates a standard LAMP-full stack environment from the scratch to hold the whole project (here is ‘mvc’). Editable/Debugable by using PhpStorm, in the env of Linux (VM Server) as well as Windows.
