加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

从家里的PHPStorm调试laravel工匠

发布时间:2020-12-14 19:41:51 所属栏目:大数据 来源:网络整理
导读:我设置了Laravel Homestead.然后我配置了homestead xdebug.ini和 PHPStorm,使调试工作. 这是我的宅基地xdebug.ini zend_extension=xdebug.soxdebug.remote_autostart = onxdebug.remote_enable = onxdebug.remote_connect_back = onxdebug.remote_port = 900
我设置了Laravel Homestead.然后我配置了homestead xdebug.ini和 PHPStorm,使调试工作.

这是我的宅基地xdebug.ini

zend_extension=xdebug.so
xdebug.remote_autostart = on
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.remote_port = 9000
xdebug.idekey = "vagrant"

要启动调试会话,我遵循的步骤是

>在PHPStorm – >开始聆听连接
>在PHPStorm中设置一个断点
>在我的浏览器中 – >使用XDebug Chrome助手或添加到我的URL?XDEBUG_SESSION_START =
>加载页面

这样做完美.我的问题是当我在homestead命令行,我运行一个php工匠命令,那么我无法得到它打破我的断点.

我试过了

> XDEBUG_CONFIG =“idekey = PHPSTORM”PHP_IDE_CONFIG =“serverName = server_name”php -dxdebug.remote_host =“127.0.0.1”artisan mycommand
> php -d xdebug.profiler_enable =关于工匠mycommand
>我也试图设置xdebug.remote_autostart = On然后sudo服务php5-fpm重新启动,但仍然我的断点从来没有在PHPStorm

两件事情很重要:

> remote_connect_back无法在CLI的情况下工作,因为Xdebug在控制台时无法检测到远程IP
>在NAT网络配置中使用homestead / VirtualBox时,您的开发机器(运行PHPStorm)没有从VM内部看到IP 127.0.0.1.相反,它通常有一个IP 10.0.2.2.要找出正确的IP,看看你的Apache的access.log,

以下为我工作:

php -dxdebug.remote_autostart=on -dxdebug.remote_connect_back=off 
  -dxdebug.remote_host=10.0.2.2 artisan

>编辑如果您的断点未被击中,您必须正确设置文件夹映射(因为您的IDE中的路径与Web服务器看到的不同:

>在VM中导出PHP_IDE_CONFIG =“serverName = yourservername”,其中您的服务器名称是您在“名称”下的屏幕截图中配置的内容
>使用IDE密钥和上面配置的服务器添加Php远程调试配置

>将您的IDE密钥和remote_host添加到虚拟机的XDEBUG-CONFIG

export XDEBUG_CONFIG =“idekey = artisan remote_host = 10.0.2.2”

参考文献:http://randyfay.com/content/remote-command-line-debugging-phpstorm-phpdrupal-including-drush

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读