Laravel Homestead 不工作的 PhpStorm 调试
PhpStorm debug with Laravel Homestead not working
我正在尝试设置 PhpStorm 以在 Vagrant Homestead 环境中正确调试。 Xdebug 已正确安装,我是 运行 PHP 7.1
在我的应用程序中设置断点后,脚本通过所有断点,我收到此消息:
debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'wedleague.loc' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
我已经检查了映射并将其设置为项目的根目录:
local path remote path
file://C:/vagrant/projects/wedleague /home/vagrant/code/wedleague
如果我设置为在第一个断点处调试,我可以完成调试会话。
在这里尝试了很多答案,但似乎没有任何效果。
如何使调试会话正常工作?
更新:
我也试过这个映射(按照建议)
file://C:/vagrant/projects/wedleague/public /home/vagrant/code/wedleague/public
仍然无法使用此配置:(
步骤 1
Install Xdebug helper 对于 chrome
第 2 步
通过 ssh(选择 putty、WinSCP、MobaXterm 等工具)
安装 xdebug,在你的情况下 laravel 得到 Ubuntu 16.04 by default with Nginx so we need to follow these instructions
我使用的值是
; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_host=10.0.2.2
在/etc/php.d/xdebug.ini
但请注意,我使用我自己的 vagrant 安装(homestead 基于 Vagrant),而不是 CentOS 和 apache。配置更改后重新启动虚拟机。
vagrant / homestead halt
重新开始
vagrant / homestead up
步骤 3
在 chrome 中配置 Xdebug 辅助扩展,方法是右键单击符号 > 选项,然后在下拉菜单中将 IDE 键 设置为 PHPStorm。
配置PHPStorm,喜欢很多
提示: 设置有快捷键ctrl + alt + s
检查以下设置。不要忘记在 Servers 设置中同时添加 http 和 https,最重要的是,不要阅读路径映射部分。
最后但并非最不重要的是点击这些按钮,第一个带有 phone 喇叭的按钮在我看来实际上有相反的图标:调试时它应该有绿色的小部分,虽然逻辑上红色意味着停止,现在它意味着开始。
按钮 2 使用查询字符串中的会话变量启动您的 url!
P.s。从你的问题:我认为你需要去 laravel 的根目录而不是 public 文件夹
编辑: 我刚刚在家里安装了 homestead,它安装了 xdebug:
我正在尝试设置 PhpStorm 以在 Vagrant Homestead 环境中正确调试。 Xdebug 已正确安装,我是 运行 PHP 7.1
在我的应用程序中设置断点后,脚本通过所有断点,我收到此消息:
debug session was finished without being paused
It may be caused by path mappings misconfiguration or not synchronized local and remote projects.
To figure out the problem check path mappings configuration for 'wedleague.loc' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
我已经检查了映射并将其设置为项目的根目录:
local path remote path
file://C:/vagrant/projects/wedleague /home/vagrant/code/wedleague
如果我设置为在第一个断点处调试,我可以完成调试会话。
在这里尝试了很多答案,但似乎没有任何效果。
如何使调试会话正常工作?
更新: 我也试过这个映射(按照建议)
file://C:/vagrant/projects/wedleague/public /home/vagrant/code/wedleague/public
仍然无法使用此配置:(
步骤 1
Install Xdebug helper 对于 chrome
第 2 步
通过 ssh(选择 putty、WinSCP、MobaXterm 等工具) 安装 xdebug,在你的情况下 laravel 得到 Ubuntu 16.04 by default with Nginx so we need to follow these instructions 我使用的值是
; Enable xdebug extension module
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_host=10.0.2.2
在/etc/php.d/xdebug.ini
但请注意,我使用我自己的 vagrant 安装(homestead 基于 Vagrant),而不是 CentOS 和 apache。配置更改后重新启动虚拟机。
vagrant / homestead halt
重新开始
vagrant / homestead up
步骤 3
在 chrome 中配置 Xdebug 辅助扩展,方法是右键单击符号 > 选项,然后在下拉菜单中将 IDE 键 设置为 PHPStorm。
配置PHPStorm,喜欢很多
提示: 设置有快捷键ctrl + alt + s
检查以下设置。不要忘记在 Servers 设置中同时添加 http 和 https,最重要的是,不要阅读路径映射部分。
最后但并非最不重要的是点击这些按钮,第一个带有 phone 喇叭的按钮在我看来实际上有相反的图标:调试时它应该有绿色的小部分,虽然逻辑上红色意味着停止,现在它意味着开始。
按钮 2 使用查询字符串中的会话变量启动您的 url!
P.s。从你的问题:我认为你需要去 laravel 的根目录而不是 public 文件夹
编辑: 我刚刚在家里安装了 homestead,它安装了 xdebug: