Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup XDebug properly in PhpStorm for Laravel web app that run in Vagrant? (Mac OS X)

I have my Laravel web app run inside Vagrant, using precise64 box.

In vagrant box: in directory /etc/apache2/sites-available , I have 000-default.conf and laratest.conf file. I'm only interested in laratest.conf right now.

Inside laratest.conf:

<VirtualHost *:80>
   ServerName laratest.dev
   ServerAlias www.laratest.dev
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/laratest/public

  <Directory /var/www/laratest/public>
    Options -Indexes +FollowSymLinks
    AllowOverride all
    Require all granted
  </Directory>     
</VirtualHost>

In my php.ini file from /etc/php5/apache2/ directory:

[xdebug]
zend_extension="./usr/lib/php5/some-number/xdebug.so"
xdebug.default_enable=1
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.idekey="vagrant"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1

So, I access my laravel web with laratest.dev url

In PHPStorm -> Preferences -> Project Settings -> PHP -> Servers , the image below is my setup: enter image description here

I already enable listener in PHP Debug Connection (Phone icon) and put a breakpoint. The breakpoint manage to hit when I run the web, but it give this error: enter image description here

Is there anything wrong with my set up? Especially mapping. I have tried so many things and googling, still can't debug properly yet

like image 987
X Sham Avatar asked Mar 18 '14 15:03

X Sham


People also ask

How does xdebug work with PhpStorm?

PhpStorm supports the use of Xdebug in the Just-In-Time (JIT) mode so it is not attached to your code all the time but connects to PhpStorm only when an error occurs or an exception is thrown. Depending on the Xdebug version used, this operation mode is toggled through the following settings: Xdebug 2 uses the xdebug .


1 Answers

It turns out this is the correct mapping I needed to make it to works

enter image description here

like image 175
X Sham Avatar answered Sep 25 '22 02:09

X Sham