简体   繁体   English

用Laravel Homestead进行PhpStorm调试不起作用

[英]PhpStorm debug with Laravel Homestead not working

I'm trying to setup PhpStorm to debug correctly within a Vagrant Homestead environment. 我正在尝试将PhpStorm设置为在Vagrant Homestead环境中正确调试。 Xdebug is correctly installed and I'm running PHP 7.1 Xdebug已正确安装,并且我正在运行PHP 7.1

After setting a breakpoint in my app the script passes through any breakpoints and I get this message: 在我的应用程序中设置断点后,脚本会通过任何断点,并且我收到以下消息:

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).

I've checked the mappings and have this set up for the root of the project: 我已经检查了映射,并将其设置为项目的根目录:

local path                              remote path
file://C:/vagrant/projects/wedleague    /home/vagrant/code/wedleague

If I set to debug at first breakpoint I can work through the debug session. 如果我设置为在第一个断点调试,则可以完成调试会话。

Tried loads of answers here but nothing seems to work. 在这里尝试了很多答案,但似乎无济于事。

What can I try to get the debug session to work correctly? 我怎样才能使调试会话正常工作?

Update: I've also tried this mapping (as suggested) 更新:我也尝试过这种映射(建议)

file://C:/vagrant/projects/wedleague/public /home/vagrant/code/wedleague/public

Still not working with this configuration either :( 仍然不能使用这种配置:(

Step 1 第1步

Install PHPStorm 2017.X 安装PHPStorm 2017.X

Install Xdebug helper for chrome 为Chrome 安装Xdebug助手

Step 2 第2步

Via ssh (choose a tool like putty, WinSCP, MobaXterm etc.) Install xdebug, in your case laravel gets Ubuntu 16.04 by default with Nginx so we need to follow these instructions The values I used are 通过ssh(选择腻子,WinSCP,MobaXterm等工具)安装xdebug,在这种情况下,laravel 默认使用Nginx获取Ubuntu 16.04,因此我们需要遵循以下说明

; 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

in /etc/php.d/xdebug.ini /etc/php.d/xdebug.ini中

But note that I use my own vagrant installation (homestead is based on Vagrant) with CentOS and apache instead. 但是请注意,我将自己的vagrant安装(宅基基于Vagrant)与CentOS和apache一起使用。 Restart your virtual machine after config changes. 配置更改后,重新启动虚拟机。

vagrant / homestead halt

and start again 然后重新开始

vagrant / homestead up

Step 3 第三步

Config Xdebug helper extension in chrome by right clicking the symbol > options and set your IDE key to PHPStorm in the dropdown menu. 通过右键单击符号>选项在chrome中配置Xdebug帮助程序扩展,然后在下拉菜单中将IDE密钥设置为PHPStorm。

Configure PHPStorm, like a lot 配置PHPStorm,就像很多

hint : Settings has the shortcut ctrl + alt + s 提示设置具有快捷键ctrl + alt + s

Check the following settings. 检查以下设置。 Don't forget to add both http and https in the Servers Setting and most important, don't read over the path mappings part. 不要忘记在“ 服务器设置”中同时添加http和https,最重要的是,请不要阅读路径映射部分。 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明

And last but not least click these buttons, the first button with the phone horn actually has reversed icons in my opinion: when debugging it should have the little green part, altough logically red would mean stop, now it means start. 最后但并非最不重要的一点是单击这些按钮,在我看来,带有手机号角的第一个按钮实际上已颠倒了图标:调试时,它应该具有绿色的小部分,从逻辑上讲,红色总是意味着停止,现在意味着启动。

在此处输入图片说明

button 2 starts your url with a session var in the query string! 按钮2在查询字符串中以会话var开头您的url!

Ps from your question: I think you need to go 1 level up root of laravel instead of public folders 从您的问题中得到的Ps:我认为您需要将laravel的根目录上移1级而不是公用文件夹

edit: I just installed homestead at home and it comes with xdebug installed: 编辑:我只是在家中安装了宅基,它带有xdebug安装: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM