下载xdebug扩大
将phpinfo()中的信息全副复制到Xdebug中的文本框中,如下图所示:点击“Analyse my phpinfo() output”按钮。

跳转到如下图所示页面,会对本机中的php进行剖析,点击“Download php_xdebug-2.7.2-7.2-vc15-x86_64.dll”按钮下载Xdebug扩大。

配置Xdebug扩大
将下载好的Xdebug扩大复制到php目录下的ext文件夹中,并在php.ini配置的开端增加如下配置信息:

zend_extension=E:\php7\ext\php_xdebug-2.7.2-7.2-vc15-x86_64.dllxdebug.profiler_output_dir="E:\php\xdebug"xdebug.trace_output_dir="E:\php\xdebug"xdebug.remote_port=9000xdebug.idekey=PHPSTORMxdebug.remote_autostart=1xdebug.remote_host=localhostxdebug.remote_enable=1

而后重启服务,再次关上phpinfo(),呈现xdebug扩大示意配置胜利

phpStorm中配置Xdebug
在罕用的编辑器中配置xdebug,以phpstorm为例,关上“File->Settings->Languages & Development->PHP->Debug”,配置XDebug监听端口号,须要与在php.ini配置文件中配置的端口号保持一致,如下图所示:

关上“File->Settings->Languages & Development->PHP->Debug->DBGp Proxy”,配置DBGp协定配置信息,如下图所示:

关上“File->Settings->Languages & Development->PHP->Server”,配置php运行服务器,如下图所示:

关上“Run/Debug Configurations”,增加“PHP Web Page”,如下图所示:

Chrome增加Xdebug helper扩大
Chrome增加完Xdebug helper扩大后,须要配置"IDE key",须要与php.ini配置文件中配置的保持一致。下面配置文件写的是PHPSTORM

开启phpStorm调试
首先设置运行服务器为localhost,而后关上php debug监听,运行debug模式,最初设置断点,如下图所示:

最初
如果你感觉这篇文章对你有点用的话,麻烦请给咱们的开源我的项目点点star:http://github.crmeb.net/u/defu不胜感激 !

收费获取源码地址:http://www.crmeb.com

PHP学习手册:https://doc.crmeb.com

技术交换论坛:https://q.crmeb.com