简体   繁体   中英

PHP Xdebug Laravel application in IntelliJ IDEA

Could you please advice me how properly configure Xdebug for Laravel application. I found a lot instructions for PhpStorm but they do not work for me as I'm using IntelliJ IDEA Ultimate.

What I have already achieved - I can debug single PHP script but not whole application. I cannot follow completely the instruction which is given for PhpStorm because on step when I need to configure Run/Debug Configuration I got stucked.

Much appreciation on any help in advance!

Okay, I gathered full instruction how to work with XDebug and IntelliJ Idea Ultimate to debug Laravel application and Windows specifically (if you use other OS the installation part will be different but other should be the same):

First of all you need to install XDebug itself and configure PHP to work with it. For that:

  • Find out which PHP version you use using phpinfo() you will need Version, Architecture and PHP Extension Build sections to complete next step.
  • Go to https://xdebug.org/download.php and download appropriate build. Basically it is dll provided for specific PHP you have installed
  • After that copy that DLL to Apache modules directory - for me that is D:\\OSPanel\\modules\\http\\Apache-PHP-7-x64\\modules\\ as I'm using OpenServer.
  • Put into php.ini file following configuration:

     [Xdebug] zend_extension="D:\\OSPanel\\modules\\http\\Apache-PHP-7-x64\\modules\\php_xdebug-2.6.0-7.1-vc14-x86_64.dll" xdebug.remote_enable = 1 xdebug.remote_host = "localhost" xdebug.remote_autostart=on xdebug.remote_enable=on xdebug.remote_port=9000 xdebug.idekey="PHPSTORM" 

where php_xdebug-2.6.0-7.1-vc14-x86_64.dll is name of dll I personally downloaded.

  • Restart Apache
  • Open your Laravel project and check your Debuggin configuration (File > Settings... > Languages & Frameworks > PHP > Debug): check XDebug section if Debug port is the same as you specified above (it should be, if you did not changet it previously)
  • Delete all your Run/Debug configurations
  • Install Xdebug Helper for Chrome or any other extension if your not using Chrome ( Browser Debugging Extensions )
  • Hit Run > Start listening for PHP Debug Connections
  • Put break point in your project and open appropriate site context
  • Enjoy!

Hope that will be useful for community.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM