idea(+xampp)下php配置debug(亲测有效)

idea安装了php插件和PHPstorm没有什么差别,一样用。

安装xampp,xampp自带xdebug,无须下载xdebug。

在php.ini配置xdebug

;xdebug库文件

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"

;开启远程调试

xdebug.remote_enable = On

;客户机ip

xdebug.remote_host="localhost"

;客户机xdebug监听端口和调试协议

xdebug.remote_port=9001

xdebug.remote_handler=dbgp

;idekey 区分大小写

xdebug.idekey="PHPSTORM"

xdebug.profiler_enable = off

xdebug.profiler_enable_trigger = off

xdebug.profiler_output_name = cachegrind.out.%t.%p

xdebug.profiler_output_dir = "d:\tmp"

用xampp的apache运行C:/xampp/htdocs,检查xdebug是否有用。

在这里查看http://localhost/dashboard/phpinfo.php

idea(+xampp)下php配置debug(亲测有效)_第1张图片

说明xdebug可用。

在idea配置php

php运行环境

idea(+xampp)下php配置debug(亲测有效)_第2张图片

CLI Interpreter的选项是点“...”添加而来的:

idea(+xampp)下php配置debug(亲测有效)_第3张图片

Xdebug端口

idea(+xampp)下php配置debug(亲测有效)_第4张图片

端口对应php.ini的remote_port。

DBGp Proxy

idea(+xampp)下php配置debug(亲测有效)_第5张图片

ide key对应php.ini的idekey,host对应php.ini的remote_host,port对应Xdebug端口。

新建php servers

新建php servers运行项php web application才会出来。


idea(+xampp)下php配置debug(亲测有效)_第6张图片

host对应php.ini的remote_host,port对应apache里项目端口,debugger选xdebug。

新建php web application

idea(+xampp)下php配置debug(亲测有效)_第7张图片

选择刚才新建的server,start url这个很关键,路径不对不是404就是找不到服务,参照apache项目的访问路径。

调试

debug监听

idea(+xampp)下php配置debug(亲测有效)_第8张图片

xampp apache启动项目

idea(+xampp)下php配置debug(亲测有效)_第9张图片

idea debug项目

看效果

idea(+xampp)下php配置debug(亲测有效)_第10张图片

参考:https://blog.csdn.net/yinhangbbbbb/article/details/79247331

你可能感兴趣的:(idea(+xampp)下php配置debug(亲测有效))