William Jiang

JavaScript,PHP,Node,Perl,LAMP Web Developer – http://williamjxj.com; https://github.com/williamjxj?tab=repositories

Tag Archives: Vagrant

Vagrant in PhpStorm

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.

  1. Download 64-bit Vagrant for Windows. Install this .msi file (144MB) locally to C:Vagrant
  2. Then in PhpStorm: Ctrl+Shift+A -> Vagrant:
    – Vagrant executable: C:Vagrantbinvagrant.exe
    – Add Vagrant Box: lucid32

  3. in current PhpStorm project, Tools -> Vagrant -> Init in Project Root:
    generate a ‘Vagrantfile’ file.
  4. Modify the new generated Vagrantfile:
    config.vm.synced_folder "./", "/vagrant_mvc"

    This way share the whole project ‘/mvc/’ into the VM Linux machine

  5. Tools -> Vagrant -> Up
    (Re)boot the VM machine and mounting shared folders
  6. 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.

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