首页 > 技术文章 > laragon 之xdebug

dreamfine 2018-05-15 13:37 原文

看上去默认没有安装调试工具。手工来吧。
PHP调试是比较蛋痛的,需要关注并配置三个地方:IDE如我用的phpstorm,浏览器,和PHP服务端。

浏览器chrom

浏览器我用google chrom,安装个调试插件,每次使用要让那个小虫子发绿。

PHP服务端php.ini

PHP服务端主要是复制文件和配置php.ini. 下面细说一下。
启动localhost/phpinfo.php页,复制所有内容,贴到这个页面中:

https://xdebug.org/wizard.php
这个小精灵,会教你设置的。大致类似这样:

Download php_xdebug-2.6.0-7.2-vc15-x86_64.dll
Move the downloaded file to D:\laragon\bin\php\php-7.2.2-Win32-VC15-x64\ext
Update D:\laragon\bin\php\php-7.2.2-Win32-VC15-x64\php.ini and change the line
zend_extension = D:\laragon\bin\php\php-7.2.2-Win32-VC15-x64\ext\php_xdebug-2.6.0-7.2-vc15-x86_64.dll
Restart the webserver

php.ini还需要加入下面这些:

xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"

9000那个端口,要和PHPSTORM 中的设置一样。
重启web服务后,在laragon中的php->Extensions中选中 xdebug那行。

PHPSTORM设置

在File -> setting ->Languages & frameworks -> PHP ->Valedate 在这里设置并校验一下就行了。如下图:

推荐阅读