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

vincej's avatar
Level 15

Laravel Valet and Xdebug inside PHPSTORM Problem

HI All, I know not manny of you use PHPSTORM, but I live in hope someone might shine a light on this problem. I should not be much different than what happens inside VS Studio.

I have upgrade to PHP 8.3 xdebug 3.3. It shows up in my php.ini file and in in a phpinfo(). Additionally it STORM shows that the debugger is installed. I am using Valet. I am not sure if symlinks are used or not so I tried with and without, to no effect. I have set Storm to stop on first line of php and it does not work.

I am using PHPSTORM as the IDE key inside chrome, however it ignore that. If I force Storm to invoke/run the debugger then it creates it's own session session key and ignores my own key. When it does that, it creates a new session in my browser and the debugger does stop at the server details. So something good is happening.

0 likes
4 replies
LaryAI's avatar
Level 58

It sounds like you're having trouble getting Xdebug to work with PHPStorm while using Laravel Valet. Here are some steps to ensure that your Xdebug setup is configured correctly for PHPStorm:

  1. Check Xdebug Installation: Verify that Xdebug is installed and enabled by running php -v in your terminal. You should see Xdebug mentioned in the output.

  2. Configure PHPStorm:

    • Go to Preferences > Languages & Frameworks > PHP > Servers.
    • Add a new server, name it (e.g., Valet), and set the host to the domain you use with Valet (e.g., myapp.test).
    • Check the box for Use path mappings and map your project directory to the corresponding directory on the server (which is usually the same for Valet).
  3. Configure Xdebug:

    • In your php.ini file (or the relevant Xdebug configuration file), ensure that the following settings are configured:
      xdebug.mode = debug
      xdebug.start_with_request = yes
      xdebug.client_port = 9003
      xdebug.client_host = 127.0.0.1
      xdebug.idekey = PHPSTORM
      
    • Restart Valet to apply the changes with valet restart.
  4. Configure PHPStorm to Listen for PHP Debug Connections:

    • Click on the Start Listening for PHP Debug Connections button in PHPStorm (it looks like a telephone handset).
    • Set a breakpoint in your code.
  5. Browser Configuration:

    • Install a browser extension like Xdebug helper for Chrome or Firefox.
    • Set the IDE key in the extension to PHPSTORM.
  6. Validate Configuration:

    • Use PHPStorm's Validate Debugger Configuration on Web Server to ensure everything is set up correctly. This can be found under Run > Web Server Debug Validation.
  7. Test Debugging:

    • Trigger the Xdebug session from your browser using the installed extension.
    • PHPStorm should now stop at the breakpoint you've set.

If you've followed these steps and debugging is still not working, consider the following:

  • Ensure that no other application is listening on the port that Xdebug is configured to use (default is 9003).
  • Check the xdebug.log file for any errors (you can set xdebug.log = /path/to/xdebug.log in your php.ini to enable logging).
  • Make sure that your firewall is not blocking the connection.

Remember that the exact paths and settings might vary depending on your specific setup and versions of PHP, Xdebug, and PHPStorm. If you continue to have issues, please provide more specific error messages or logs for further assistance.

digital-pig's avatar

You're not alone. I've been battling PHP8.3 and Xdebug 3, with PhpStorm, also. And on the remote server everything says it's cool.

One thing you can try is see if you can do a command-line debug on the server using Xdebug (instructions on their site). That should at least tell you whether the issue is PHP or PhpStorm.

mwguerra's avatar

There are "2 (two)" php to take care of after installing xdebug manually or via PECL (pecl install xdebug). One is the PHP command line and the other is PHP-FPM. Even if php -v shows the xdebug extension installed, the php-fpm needs to be restarted. with valet, you can run

valet restart php

Start the Laravel app (npm run dev). If you are not using the xdebug browser extension, add to th end of the url being tested first:

https://yourtestdomain.test/yourroute/?XDEBUG_SESSION=whateveryouwanttocallyoursession

Also, check for which modes you want to enable in xdebug. You'll find the configuration in your php.ini file. For example, mine is:

xdebug.mode=develop,debug,coverage

You can see what is actually enabled executing the xdebug_info() function.

Please or to participate in this conversation.