【问题标题】:Can't debug WordPress with PhpStorm, WAMP & Virtual Hosts无法使用 PhpStorm、WAMP 和虚拟主机调试 WordPress
【发布时间】:2018-04-23 13:30:53
【问题描述】:

网上有很多可能的设置和演示,但我无法让调试器工作(什么也没发生!)

Windows 设置

WAMP 安装:

C:\Wamp

项目文件夹:

"E:\Users\Rix\Offline Drive\Web Ghianda\Wordpress"

vhosts.conf:

<VirtualHost *>
    DocumentRoot "E:\Users\Rix\Offline Drive\Web Ghianda\Wordpress"
    ServerName ghiandalocal.com
      <Directory "E:\Users\Rix\Offline Drive\Web Ghianda\Wordpress">
        Order allow,deny
        Allow from all
      </Directory>
  </VirtualHost>

PhpStorm 配置设置(也尝试将127.0.0.1 更改为ghiandalocal.com):

PHP.ini Xdebug 部分

[xdebug]
zend_extension=c:\wamp\bin\php\php7.0.4\ext\php_xdebug-2.5.4-7.0-vc14.dll
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1:81
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=0
xdebug.profiler_output_name=cachegrind.out.%s.%t
xdebug.profiler_output_dir="C:/wamp/tmp/xdebug"
xdebug.trace_output_dir="C:/wamp/tmp/xdebug"
xdebug.idekey=PHPSTORM

PHP信息:https://ibb.co/cmA5Lw

【问题讨论】:

  • 1) xdebug.remote_host=127.0.0.1:81 -- 你在哪里看到的?它必须只是一个 IP。 Xdebug 根本不关心您的 Web 服务器端口。 2) 您使用什么 URL 在浏览器中浏览本地站点?是http://127.0.0.1/ 吗? 3) 启用 xdebug 日志,看看它对这种不成功的调试会话有什么看法。
  • 浏览我使用的网站ghiandalocal.com
  • 在php.ini中添加了xdebug.remote_log=c:/temp/xdebug.log,但是重新加载网页时没有创建日志
  • 1) 创建一些文件并在那里调用phpinfo() -- 显示它的输出 -- 顶部表(通用信息),然后是 xdebug 特定部分。 2) 必须使用您的设置 (remote_autostart=1) 创建 xdebug,因为 xdebug 应该尝试调试每个请求。
  • 3) 您的ghiandalocal.com 是否解析为127.0.0.1?在控制台中运行ping ghiandalocal.com 时看到的 IP 是什么?

标签: phpstorm wamp xdebug vhosts


【解决方案1】:

检查 Phpinfo,我意识到 PHP 正在从另一个文件夹加载 php.ini,因此没有加载 xdebug 设置。 感谢LazyOne 启发解决方法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-01
    • 2016-02-23
    • 2011-09-30
    • 2016-01-08
    • 2011-05-20
    • 2013-03-15
    • 2014-07-15
    • 2014-09-20
    相关资源
    最近更新 更多