Skip to content
This repository has been archived by the owner on Jan 23, 2018. It is now read-only.

Debugging with PhpStorm

jonuy edited this page Dec 16, 2014 · 1 revision

You can pretty much just follow this: http://blog.elenakolevska.com/debugging-laravel-on-homestead/

Configure php.ini

  • ssh into homestead vagrant:

    $ cd /path/to/ds-homestead
    $ vagrant ssh
    
  • Edit 20-xdebug.ini

    $ sudo vim /etc/php5/fpm/conf.d/20-xdebug.ini
    
    • Modify the file to:
      zend_extension=xdebug.so
      
      xdebug.remote_enable = 1
      xdebug.remote_connect_back = 1
      xdebug.remote_port = 9000
      
  • Restart php to load the new extension and configurations

    $ sudo service php5-fpm restart
    

Configure PhpStorm

  • Settings > Languages & Frameworks > PHP > Interpreter
    • Add new Remote...
    • Select Vagrant
    • For the "Vagrant Instance Folder", set this to your ds-homestead directory
    • Test Connection and verify it works

Trigerring the Debugger

  • Get Xdebug Helper for Chrome
    • Go to Xdebug Helper options and change IDE key to "PhpStorm"
  • and/or add ?XDEBUG_SESSION_START=PHPSTORM to your http requests

Debugging

  • In PhpStorm, click Run > Start Listening for PHP Debug Connections

  • When you make a request, there should be a popup from PhpStorm that will automatically add the PHP server and its configurations. The blog post above suggests editing the port number to 8000, but I found that didn't work for me. Leaving it alone at port 80 did however work.

  • You'll also likely need to map the root of your project to the appropriate vagrant folder

    • Go to Settings > Languages & Frameworks > PHP > Servers

    • Select the server for your project

    • Select the root directory of your project and then set the "Absolute path on the server"

      ex:
      File/Directory: /Users/juy/projects/DS/user-api
      Absolute path on server: /home/vagrant/sites/user-api

Clone this wiki locally