1

I was using sublime and VScode for the development. Recently I heard that PHPStorm is the best IDE for the Magento2 development and using xdebug you can easily debug the issues and write modules. I tried to setup my system for PHPstorm IDE. To be honest, I tried for 3-4 weeks to setup PHPStorm and Xdebug to run together in my system but it's not working. I believe on this platform there are many geeks might have seen this issue and would help me to resolve those issue.

Operating System: Ubuntu 18.04 PHPStorm: Latest Version: 2020.3.2 Webserver: Nginx PHP: PHP7.3-fpm

I have already install xdebug in linux and configured in /etc/php/7.3/fpm/php.ini and /etc/php/7.3/cli/php.ini

If I run phpinfo() it shows xdebug is already installed. Also, I have installed xdebug Firefox and Chrome extensions (which I saw in one of the video on youtube) but unfortunately still not working.

I have done required configuration by following some articles but unfortunately, xdebug is not working and not showing anything. I tried to set the break point in my extension and When I start the debug it also loads the website with query string: http://jacksontest.site/?XDEBUG_SESSION_START=19345 but xdebug is not showing any results. Xdebug keep showing the result shown in below screenshot. Even if I refresh the page, it's not showing anything.

I have installed xdebug helper browser extensions for firefox and chrome as well. I also kept those extensions enabled but still no luck. Could you please help me?

enter image description here

I checked many articles, youtube videos but not able to get it work. There are many developers like me who has just started using the PHP storm but don't know how to configure and use Xdebug with it.

I would really really appreciate if anyone can help me to set it up.

Thank you.

Articles I followed: Magento 2 PHPSTORM Xdebug Configuration setup

https://magenest.com/en/debug-magento-2-code-xdebug-phpstorm-1/

https://magenest.com/en/debug-magento-2-xdebug-phpstorm-part-2/

https://medium.com/@mailtoankitgupta/remote-debug-magento-server-using-phpstorm-xdebug-30ba2c79e9b6

https://paulmestereaga.com/remote-debugging-magento-xdebug-phpstorm/

2

Note: I would rather enter this as a comment than an answer, but don't have the rep for it.

I personally have only set up Xdebug with apache and netbeans, but I can't imagine they are too different. Here is a checklist of things to check:

  • This might seems like a stupid point, but make sure you aren't attempting to stop on a file that might be generated and therefore causing you to put a breakpoint somewhere that might not be hit
  • Whatever port you configured in your php.ini file (I think 9000 is default) needs to be matched in your PHPStorm configuration
  • If you are connecting remotely for debugging (like if you run your webserver on a VM and code/debug on your actual machine) ensure your firewall isn't blocking it by temporarily disabling it and attempting to debug. Obviously you will want to turn your firewall back on afterwards and if this was the issue to configure a rule to allow those connections
  • In the same vein as above, if using a remote connection you will want to ensure Xdebug is configured to allow a remote start for debug sessions in your php.ini
  • If you are serving content from /pub/index.php make sure that starting path is reflected in your starting URL in PHPStorm (This might be more specific to netbeans, but figured I'd mention it)
2
  • Thanks for your reply. I did try that checklist but still no luck. Mar 6 at 15:30
  • Have you tried enabling logging for xdebug and seeing if that gives you any clues? Mar 6 at 20:05
1

Remove all the previous setting and reset phpstrom and follow these steps: https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html#integrationWithProduct from the official documentation.

Xdebug’s default debugging port has changed from 9000 to 9003 in xdebug3, so please consider that as well.

PHP languge level and cli interpreter should same version in settings | Languages & Frameworks | Php php settings

also check PHP | Debug setting

enter image description here

Then Run | Start listening for Php debug connections. Hope this will work.

2
  • Thanks for your reply. but still no luck. Worst part is there isn't any error message. It loads the site in browser but not loading callstack and debugging. Not showing any option at all. Any help would be appreciated! Mar 6 at 15:30
  • I update the answer with setting screenshot. I hope it will help you.@JacksonWyss Mar 8 at 5:20
0

Please check if /etc/php/7.3/mods-available/xdebug.ini has the following details:

zend_extension=xdebug.so
xdebug.remote_autostart = 0
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000
xdebug.max_nesting_level = 500
xdebug.mode=debug

If it is missing, please add and restart Nginx

sudo service nginx restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.