Vagrant Homestead 上的 PhpStorm 和 XDebug

标签 php vagrant phpstorm xdebug homestead

我在 Windows 上,我正在尝试通过 XDebug 使用 PhpStorm 调试 Web 应用程序(由 Vagrant/Homestead 托管)。我尝试了很多配置,但无法正常工作。 PhpStorm XDebug 设置非常常见。

这是当前的 xdebug 配置:

vagrant@homestead: /etc/php/7.0/cli/conf.d/20-xdebug.ini

zend_extension=xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey='PHPSTORM'

在 IDE“开始监听 PHP 调试连接”中,它已打开。当我尝试开始调试时,一个新的 chrome 选项卡打开并且 URL 结束,例如 ?XDEBUG_SESSION_START=16588 但调试器没有运行,这就是 IDE 所说的:

enter image description here

此外,netstat 表示端口 9000 仍在监听。 有什么想法吗?

最佳答案

您正在为命令行界面 (CLI) 更改 20-xdebug.ini 文件。相反,您需要更改 Apache 设置的 /etc/php/7.0/apache2/conf.d/20-xdebug.ini,因为您使用的是 Chrome。

更新

我不确定 Apache 和 Nginx 之间的区别(可能是 /etc/php/7.0/fpm/conf.d/20-xdebug.ini),但这是如何我在 Windows 计算机上使用运行 Apache 的 VirtualBox VM 让它工作。

20-xdebug.ini 的设置:

zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.1... (your windows IP address within your network)
xdebug.remote_port=9000
xdebug.autostart=1

关于Vagrant Homestead 上的 PhpStorm 和 XDebug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40944126/

相关文章:

php - 如何让 PhpStorm 在文本的开头而不是行注释一行?

debugging - 在 PhpStorm 中设置调试变量列表的顺序

php - 更新到 v4.8.0 后 phpMyAdmin 出错 : The $cfg ['TempDir' ] (./tmp/) 无法访问

Vagrant + 并行

默认情况下,在 SublimeText 中打开的 Vagrantfile 作为 Ruby 扩展文件

reactjs - 如何使用 Vagrant VM 通过共享文件夹启用热重载?

symfony - 使用 PhpStorm 和 Xdebug 在 Docker 中调试 Symfony2

php - 在提出内存问题之前,php 数组可以有多大?

php - 推送通知服务,如 ios facebook 应用程序

php - 如何在 Laravel 4 中更新字段的列?