Debugging in PHPStorm using Xdebug does not work
I cannot debug in PHPStorm.
I have my Xdebug setting correct already. In fact, I can debug by VSCode, therefore the problem is not from Xdebug configuration.
I run PHPStorm 2024.1.4 on Windows
and my website on WSL
.
My PHP info validate debugger configuration:

Xdebug enabled


Have it listen:

Xdebug helper enabled in Chrome.
Even tried to set idekey=PHPSTORM (then remove it) but still not work
But when I request the page in browser, it does not trigger Xdebug/debugging in PHP Storm. Nothing happen.
What should I do?
Please sign in to leave a comment.
Hi Thangnguyenmanh,
Please perform the following:
1. Enable additional debugging by navigating to Help | Diagnostic Tools | Debug Log Settings and adding the following line there
#com.jetbrains.php.debug
. Apply changes.2. Configure Xdebug log: https://xdebug.org/docs/all_settings#log.
3. Create a
phpinfo()
file, set a breakpoint in it, and open it in a browser. If you see the ‘Incoming connection’ dialog, please take a screenshot and send it to me. Also, share the content of the phpinfo() page itself, Xdebug log, and logs from Help | Collect Logs and Diagnostic Data.All the files can be uploaded here: https://uploads.jetbrains.com/.
Thank Anastasiia Zyrianova.
After the original post, I did some extra search and found some blog posts on PHP Storm debugging on WSL which recommends setting xdebug.client_host to Windows' IP (get via ipconfig command) therefore I added this to php.ini
xdebug.client_host=192.168.1.230
After that, it can listen and break at first line of the app. However, it does not stop at break points as intended. During that process, I get ‘Incoming connection dialog’ and do the mapping of relative files path. Unfortunately there's no way to get back the ‘Incoming connection’ dialog.
Php info: Upload id: 2024_07_09_CNTmLHJjhdn1Are54vgbHt (file: PHP 8.2.19 - phpinfo().html)
Logs and Diagnostic data: Upload id: 2024_07_09_kzfdLw8MteiXSW8tfAP75d (file: phpstorm-logs-20240709-17060110974402076149389950.zip)
Xdebug log: Upload id: 2024_07_09_BiVQzVC5KCKi5zYa47cCFx (file: xdebug.log)
It's very likely that the problem caused by the between PHPStorm vs. WSL and it doesn't cover in the docs. So far, I cannot get it stop at the break point.
Could you please disable Settings | PHP | Debug | Ignore external connections through unregistered server configurations option and check once again?
Dear Anastasiia Zyrianova
Yes it now prompt the Incoming Connection from Xdebug.
On the “File path on server”, what should I put:
- The entry point of the project (Laravel project, which is
public/index.php
?- The the actual controller that serve that path (this request is to the entry point
myproject.test/
and served byHomeController@index
?Since last time I choose the
public/index.php
and it does not stop at break point. And since it cannot be changed later, I need to seek your advice before proceed and report the result.Thank you very much.
Path mappings can be adjusted in Settings | PHP | Servers at any moment. You can also remove the existing configuration(-s) from this submenu, initiate a new connection, and the Incoming Connection dialog will appear.
In general, this dialog should automatically set the required path mappings, so the absolute path to the file or folder on the target server is set.
It does not stop at breakpoint. Can only stop at first line if choose “Break at first line in PHP scripts”.
If does not choose “Break at first line in PHP scripts”, following message appear:
My mapping:
Could you please clear the existing Xdebug log, reproduce the issue without the ‘Break at first line in PHP scripts’ option enabled, and send me both the fresh Xdebug log and PhpStorm logs from Help | Collect Logs and Diagnostic Data?
Map the parent (project) folder instead. Right now only the entry point
index.php
is mapped (according to your screenshot).I've cleared the Xdebug log, uncheck “Break the first line in PHP scripts”, then run again. It does not produce any Xdebug log anymore.
The PHPStorm's Logs and Diagnostic Data: Upload id: 2024_07_12_CkuN9AKkErWAnMtrsPUgoM (file: phpstorm-logs-20240712-0846016397949599849962750.zip)
Andriy Bazanov Thank you, I've tried it but still it does not stop at breakpoint
Thangnguyenmanh
The path should be
/var/www/…
– the actual local path on a system, similar to what you had before.Andriy Bazanov
Thank you, it works now.
Instead of using default path suggested by PHPStorm (//wsl$/Almalinux9…), we must manually type in the file path to project's root
/var/www/projectname
Thank you very much for your help
I want to chime in and say this thread helped me fix my local dev environment as well. Cheers!
Same for MacOS: Use something like “/var/www/html…” instead of the suggested "/Users/<user>/<dir>/<project>…