php调试是不是很爽?来看看用PhpStorm xDebug怎么调试吧~
一、下载xdebug
首先我们要去下载xdebug扩展,放在php的ext目录中~
当然如果你是用的集成环境开发,那只需要去扩展选项勾选了就行~
二、配置xdebug
打开 phip.ini ,搜索 xDebug 修改或者添加以下配置
[XDebug]
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir ="你的目录\xdebug"
xdebug.trace_output_dir ="你的目录\xdebug"
xdebug.profiler_output_name = "cache.out.%t-%s"
;xdebug.remote_enable = 1
;xdebug.remote_handler = "dbgp"
;xdebug.remote_host = "127.0.0.1"
zend_extension="你的目录\xdebug.dll"
;添得东西
xdebug.idekey=PHPSTORM
xdebug.remote_enable = On
xdebug.remote_host=localhost
xdebug.remote_port=9000 //这个端口是PhpStrom的默认端口,如果被占用要更换
xdebug.remote_handler="dbgp"
三、配置PhpStrom
首先来设置调试的监听端口,确保与 php.ini 中的端口一致~
接着来配置项目的运行设置:
创建 PHP WEB应用设置:
填写配置信息
然后就可以打断点以调试模式运行了~