q66262 发表于 2018-12-11 10:34:34

PHP 动态调试

  referer:http://blog.运维网.com/13770310/2175286
https://xdebug.org/download.php
  phpstorm+phpstudy 动态调试环境,phpstorm安装参考:http://blog.运维网.com/010bjsoft/2176217
phpstudy2016自带xdebug扩展,不过php.ini不大一样,要对照着参数改改。
  安装phpstudy后,开启php扩展 xdebug
  对照修改php.ini


xdebug.profiler_output_dir="D:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir="D:\phpStudy\tmp\xdebug"
zend_extension="D:\phpStudy\php\php-5.6.27-nts\ext\php_xdebug.dll"
xdebug.auto_trace=on
xdebug.collect_params=on
xdebug.collect_return=on
xdebug.profiler_enable=on
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host= 127.0.0.1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM

  安装 phpstorm 和配置 有点繁琐:
  文件->设置->语言和框架->PHP功能的 project Configuraction
http://i2.运维网.com/images/blog/201809/18/d790591f4144d3e86877af7e5b6c7da3.png
  默认在 PHP languagelevel 中会自动选择当前的php版本, CLI Interpreter 需要手工创建下,选择下 php.exe 路径:
http://i2.运维网.com/images/blog/201809/18/d059441dd09d0c9291374aaa0424d563.png
  文件->设置->语言和框架->PHP->debug
http://i2.运维网.com/images/blog/201809/18/12f1e4e86d4c5f39b0f74bc51e9218a4.png
  文件->设置->语言和框架->PHP->debug->DBGp Proxy,这里配置的和 php.ini 文件的主机和端口要一致,如果有冲突则换个端口
http://i2.运维网.com/images/blog/201809/18/f679cf0973c543804c3ec286b9da72f3.png
  然后导航栏里面点 编辑结构->创建一个并配置server 就是当前http服务, 还有默认监听的浏览器,如下:
http://i2.运维网.com/images/blog/201809/18/aefc196bf9fbd0174b94ee68a5886e2a.png
  输入需要调试的url
http://i2.运维网.com/images/blog/201809/18/1c629f339cbd4221da10c722e6480760.png
  然后点 第二个 蓝色的 调试 按钮, 就出来了。
http://i2.运维网.com/images/blog/201809/18/05e5aba35d056075e97b3c687a893708.png



页: [1]
查看完整版本: PHP 动态调试