简体   繁体   English

IntelliJ IDEA中的PHP Xdebug Laravel应用程序

[英]PHP Xdebug Laravel application in IntelliJ IDEA

Could you please advice me how properly configure Xdebug for Laravel application. 您能否建议我如何为Laravel应用程序正确配置Xdebug。 I found a lot instructions for PhpStorm but they do not work for me as I'm using IntelliJ IDEA Ultimate. 我找到了很多有关PhpStorm的说明,但是由于我使用的是IntelliJ IDEA Ultimate,它们对我不起作用。

What I have already achieved - I can debug single PHP script but not whole application. 我已经实现的目标-我可以调试单个PHP脚本,但不能调试整个应用程序。 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. 我无法完全遵循针对PhpStorm的说明,因为在需要配置运行/调试配置的步骤上,我遇到了麻烦。

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): 好的,我收集了完整的说明,如何使用XDebug和IntelliJ Idea Ultimate专门调试Laravel应用程序和Windows(如果您使用其他操作系统,则安装部分将有所不同,但其他部分应该相同):

First of all you need to install XDebug itself and configure PHP to work with it. 首先,您需要安装XDebug本身并配置PHP才能使用它。 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. 使用phpinfo()找出要使用的PHP版本,需要“版本”,“体系结构”和“ PHP扩展构建”部分来完成下一步。
  • Go to https://xdebug.org/download.php and download appropriate build. 转到https://xdebug.org/download.php并下载适当的版本。 Basically it is dll provided for specific PHP you have installed 基本上,它是为已安装的特定PHP提供的dll。
  • 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. 之后,将该DLL复制到Apache模块目录-对我来说是D:\\OSPanel\\modules\\http\\Apache-PHP-7-x64\\modules\\因为我正在使用OpenServer。
  • Put into php.ini file following configuration: 将以下配置放入php.ini文件中:

     [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. 其中php_xdebug-2.6.0-7.1-vc14-x86_64.dll是我个人下载的dll的名称。

  • Restart Apache 重新启动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) 打开您的Laravel项目并检查Debuggin配置(“文件”>“设置...”>“语言和框架”>“ PHP”>“调试”):如果“ Debug port ”与上面指定的相同,请检查“ XDebug”部分(如果没有更改,则应为“ Debug port )。先前)
  • Delete all your Run/Debug configurations 删除所有运行/调试配置
  • Install Xdebug Helper for Chrome or any other extension if your not using Chrome ( Browser Debugging Extensions ) 如果您不使用Chrome,请安装Xdebug Helper for Chrome或任何其他扩展( 浏览器调试扩展
  • Hit Run > Start listening for PHP Debug Connections 点击运行>开始侦听PHP调试连接
  • Put break point in your project and open appropriate site context 在项目中放置断点并打开适当的站点上下文
  • Enjoy! 请享用!

Hope that will be useful for community. 希望这对社区有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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