安装xdebug
首先查看一下自己的php版本信息
去官网下载对应版本的xdebug扩展
链接:https://xdebug.org/download.php
或者右键查看phpinfo()输出的源代码,到这个页面:https://xdebug.org/wizard
将phpinfo()输出的信息全选复制到输入框内
*注:使用phpstudy自带的xdebug最好,可能下载下来的版本和自己php版本不匹配,导致无法开启调试
修改php.ini文件,添加以下xdebug配置
zend_extension = D:\phpstudy_pro\Extensions\php\php7.3.4nts\ext\php_xdebug.dll
xdebug.auto_trace= On
xdebug.show_exception_trace= On
xdebug.remote_autostart= 1
xdebug.remote_enable= On
xdebug.remote_host = localhost
xdebug.remote_port=9100
xdebug.remote_handler=dbgp
xdebug.collect_vars= On
xdebug.collect_return= On
xdebug.collect_params= On
xdebug.profiler_enable=On
xdebug.trace_output_dir=“D:\phpstudy_pro\xdebug”
xdebug.profiler_output_dir =“D:\phpstudy_pro\tmp\xdebug”
xdebug.idekey=“PHPSTORM”
保存文本并重启php环境,查看phpinfo()是否安装成功
phpstorm配置xdebug
1、依次打开File→settings
2、依次打开Run→Edit Configurations
4、到这里基本就配置完成了,现在开始运行xdebug
这样就可以进行debug调试了!!!