Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

How debug laravel app with PhpStorm / xdebug?

Hello, If there is a way to debug laravel application with PhpStorm 2019 and xdebug? If yes, how?

Thanks!

0 likes
12 replies
PetroGromovo's avatar

Thanks, This article has a bit different dialog of printscreens in comparison with my PhpStorm 2019.2.3. Alsdo for my app I use appache hosting defined in /etc/apache2/sites-available/local-hostels3.com.conf as :


<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /_wwwroot/lar/hostels3/public    
   ServerName local-hostels3.com          
   ServerAlias local-hostels3.com
       
   <Directory /_wwwroot/lar/hostels3/public>
     AllowOverride All
     Order Deny,Allow
     Allow from all
     Require all granted
   </Directory>
   
   Options FollowSymLinks
   DirectoryIndex index.php
   
   ErrorLog /_wwwroot/lar/hostels3/storage/logs/error.log
   CustomLog /_wwwroot/lar/hostels3/storage/logs/access.log combined
</VirtualHost>

Could you please take a look : https://prnt.sc/ubbje8 ?

automica's avatar

@petrogromovo are you now looking at how to you use it?

we use it by appending the following query on a url

?XDEBUG_SESSION_START=PHPSTORM

and then click on the old telephone handset icon in phpstorm to turn it green and start listening for a connection.

until you have breakpoints set up set 'break at first line in php' checkbox in xdebug config and you should get a response from xdebug when you hit your url.

1 like
automica's avatar

@petrogromovo I hadn't needed to set anything up for Laravel within the run/config panel.

i'm running 2019.2 on windows and my panel looks different to you but i'm using material theme.

1 like
PetroGromovo's avatar

Thanks!

  1. Could you please to modify xdebug.remote_port, as I read :
xdebug.remote_port = <port_number>
By default, Xdebug listens on port 9000.

I work with lamp on ubuntu 18 locally on my laptop and on Digital Ocean server.

  1. I read next :

Debug port field, select the Can accept external connections checkbox. Select the Force break at the first line when no path mapping is specified checkbox to

I do not see these options. On which config page have I to search them ?

PetroGromovo's avatar

Please, explain where do you set

 ?XDEBUG_SESSION_START=PHPSTORM

? in url of laravel app?

automica's avatar

@petrogromovo you set your remote port in php.ini

something like this:

zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.remote_port = 9000
xdebug.max_nesting_level = 512
xdebug.remote_log = /tmp/xdebug.log
xdebug.remote_host=10.0.2.2

for the force break at first line, you can find that checkbox in setttings > Debug in phpstorm

1 like
PetroGromovo's avatar

What is "10.0.2.2" in you code? If that is local server have it be "local-hostels3.com" from /etc/apache2/sites-available/local-hostels3.com.conf (I wrote above) ?

automica's avatar

@petrogromovo as you are running xdebug locally, you can set that to

xdebug.remote_host = 127.0.0.1
1 like

Please or to participate in this conversation.