PhpStorm - 本地动态调试-下载配置xdebug扩展
00x01 查看phpinfo
<?php
phpinfo();
00x02下载扩展前查看Architecture
如果Architecture是x86,意味着你要下载32位的,注意不是你的电脑系统64位你就要下载64位,这个显示的不是我们的系统是几位的,而是另一个概念。如果是x64就下载64位的。
通过上图得知我需要下载的扩展版本是:php7.3版本,64位的,NTS的,VC15的。
Loaded Configuration File是待会要修改php.ini的路径。
00x03下载扩展
https://xdebug.org/download
00x04 将下载的文件拉进php.ini同目录
将下载的文件拉进php.ini同目录
00x05 配置php.ini
1、打开phpinfo里Loaded Configuration File 的php.ini文件,搜索
[XDebug]
2、替换掉Xdebug下的内容
zend_extension="扩展的绝对路径"
xdebug.idekey=phpstorm
xdebug.remote_enable = On
xdebug.remote_host=localhost
;xdebug.remote_port 用于配置phpstorm的
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.auto_trace = On
PS:突然发现我这里用的phpstudy可以直接启动xdebug拓展
00X07 重启服务器
重启(apache、nginx)等,再刷新info.php,搜索xdebug
[Xdebug]
zend_extension=C:/phpstudy_pro/Extensions/php/php7.3.4nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=On
xdebug.trace_output_dir=C:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.trace
xdebug.profiler_enable=On
xdebug.profiler_output_dir=C:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.profiler
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.idekey=phpstorm
00x08配置phpstorm
端口与ini文件里的 xdebug.remote_port 一致
00x09简单测试
新建一个服务
<?php
$a = 'aaa';
$b = 'bbb';
$c = 'ccc';
echo "111";
00x10报错
解决:
点击Click to set up path mappings
添加要调试的文件