一、查看当前php环境信息

二、安装php xdebug扩展
我下载Xdebug 2.6.1稳定版
在phpinfo中看到电脑是x64的,所以选择64位的下载。
官网:https://xdebug.org/download.php
文件:PHP 7.0 VC14 (64 bit)

--配置xdebug
将php_xdebug-2.6.0-7.0-vc14-nts-x86_64.dll复制到PHP扩展目录中,对应的目录根据实际情况来。
在php.ini中添加配置
[XDebug]
zend_extension=php_xdebug.dll
xdebug.profiler_enable = On
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir ="G:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir ="G:\phpStudy\tmp\xdebug"
xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.remote_mode = "req"
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
xdebug.idekey = PHPSTORM
xdebug.auto_trace=On
xdebug.remote_autostart=On
xdebug.remote_log="G:\phpStudy\tmp\xdebug.log"
重启下环境,打印phpinfo(),查看有没有XDebug扩展。
三、配置phpstorm
3.1 打开phpStorm,快捷键Clt+Alt+S打开settings搜索Xdebug.选择下php7环境以及看下xdebug的配置。


3.2 进入Settings>PHP>Debug>DBGp Proxy。
IDEkey:填PHPSTORM,
host填test.shuchengxian.com,
port填9000

3.3 进入Settings>PHP>Servers,这里要填写服务器端的相关信息,
如:name填test.shuchengxian.com,
host填test.shuchengxian.com,
port填80,
debugger选XDebug

3.4 进入Run> Debug configurations,点+号选择PHP Web Application,
Server选填test.shuchengxian.com,
Start URL填你要访问的页面(如:/index.php),
Browser 默认或者选chrome


运行项目

网友评论