如何在 PhpStorm 中为在 Vagrant 中运行的 Laravel Web 应用程序正确设置 XDebug?(Mac OS X)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22484304/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to setup XDebug properly in PhpStorm for Laravel web app that run in Vagrant? (Mac OS X)
提问by X Sham
I have my Laravel web app run inside Vagrant, using precise64
box.
我使用precise64
box在 Vagrant 中运行我的 Laravel Web 应用程序。
In vagrant box:
in directory /etc/apache2/sites-available
, I have 000-default.conf
and laratest.conf
file. I'm only interested in laratest.conf
right now.
在流浪箱中:在目录中/etc/apache2/sites-available
,我有000-default.conf
和laratest.conf
文件。我只对laratest.conf
现在感兴趣。
Inside laratest.conf:
在 laratest.conf 中:
<VirtualHost *:80>
ServerName laratest.dev
ServerAlias www.laratest.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/laratest/public
<Directory /var/www/laratest/public>
Options -Indexes +FollowSymLinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
In my php.ini
file from /etc/php5/apache2/
directory:
在我的目录中的php.ini
文件中/etc/php5/apache2/
:
[xdebug]
zend_extension="./usr/lib/php5/some-number/xdebug.so"
xdebug.default_enable=1
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.idekey="vagrant"
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
So, I access my laravel web with laratest.dev
url
所以,我使用laratest.dev
url访问我的 Laravel 网站
In PHPStorm -> Preferences -> Project Settings -> PHP -> Servers
, the image below is my setup:
在PHPStorm -> Preferences -> Project Settings -> PHP -> Servers
,下图是我的设置:
I already enable listener in PHP Debug Connection (Phone icon) and put a breakpoint. The breakpoint manage to hit when I run the web, but it give this error:
我已经在 PHP 调试连接(电话图标)中启用了侦听器并放置了一个断点。当我运行网络时,断点设法命中,但它给出了这个错误:
Is there anything wrong with my set up? Especially mapping. I have tried so many things and googling, still can't debug properly yet
我的设置有问题吗?尤其是映射。我已经尝试了很多东西并谷歌搜索,仍然无法正常调试
回答by X Sham
It turns out this is the correct mapping I needed to make it to works
事实证明,这是我使其正常工作所需的正确映射