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

BikashKatwal's avatar

How to setup xdebug for homestead in phpstrom

I have been using homestead for executing the project. I want to setup the xdebugger, I have tried by following the link https://www.jetbrains.com/help/phpstorm/configuring-remote-interpreters.html , but I am not able to rub the debugger. Could you please help me to setup the debugger.

0 likes
16 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

I just set it up a few days ago.

Got it working by changing the xdebug config on Homestead. Then start xdebug sudo phpenmod xdebug and restart php7.3-fpm sudo service php7.3-fpm restart

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

In phpstorm I just added a configuration for a "PHP Web Page"

Sinnbeck's avatar

You can change it using sudo nano /etc/php/7.3/fpm/conf.d/20-xdebug.ini

Use ctrl+x to exit and save the file.

I have no clue why their guide does not work. You should ask jetbrains that instead :)

Sinnbeck's avatar

Yes all of those things should be run inside vagrant ssh :)

Sinnbeck's avatar

It should be the correct one. But you can easily check it inside vagrant ssh

Run this and check the ip.

last --limit=1

Mine gave me

vagrant  pts/0        10.0.2.2         Wed Nov 13 07:44   still logged in
Sinnbeck's avatar
  1. Add PHP Web Page
  2. Add server
  3. Set host to the one you are using (leave port and debugger alone)
  4. Check Use path mapping
  5. Under project files set the path you are using in homestead in the right field (/home/vagrant/code/)
  6. Click ok and ok.
  7. Select the config from the dropdown and click the "bug" icon
BikashKatwal's avatar

@sinnbeck I think I am getting into this but now I am getting Debug session was finished without being paused It may be caused by path mappings misconfiguration or not synchronized local and remote projects. To figure out the problem check path mappings configuration for 'quiz.test' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu). warning message. I have setup project files /home/vagrant/web and public /home/vagrant/web/public. but it is not debugging.

Sinnbeck's avatar

Are you sure that your code is in /home/vagrant/code? Is it in a sub folder perhaps?

BikashKatwal's avatar

@sinnbeck

folders:
 -map: D:\Tutorials\NurseProject\web\quiz
      to: /home/vagrant/web


sites:
  - map: quiz.test
     to: /home/vagrant/web/public
Sinnbeck's avatar

Not sure if thats a windows issue.

You can try removing path mapping and check "Force break at first line when no path mapping specified" in settings -> Languages-> PHP ->Debug

Sinnbeck's avatar

Congratulations! That means it works.

It just cannot map your folder out. To hit the breakpoint you need the path mapping. Try setting it up again. You can try posting a screenshot of your configuration

Please or to participate in this conversation.