502调试php 7 Xdebug 2.4.0RC3 mac os时网关错误
我正在使用最新版本的502调试php 7 Xdebug 2.4.0RC3 mac os时网关错误,php,nginx,homebrew,xdebug,Php,Nginx,Homebrew,Xdebug,我正在使用最新版本的PHP(7.0.2)和xdebug(2.4.0RC3)和phpstorm9.0.2进行调试,当我开始调试时,我立即得到 error "502 Bad Gateway" 有时我会一步一步地完成几行代码,但不管怎样,我还是会出错 当我有以前版本的PHP(5.6)和xdebug时,一切都很棒 另外,php、nginx和xdebug都是用自制软件安装的。您可以尝试以下方法: 打开你的php.ini,抱歉,我不知道它在MacOS中的位置,在Ubuntu中它是打开的 /etc/php/
PHP(7.0.2)
和xdebug(2.4.0RC3)
和phpstorm9.0.2
进行调试,当我开始调试时,我立即得到
error "502 Bad Gateway"
有时我会一步一步地完成几行代码,但不管怎样,我还是会出错
当我有以前版本的PHP(5.6)
和xdebug
时,一切都很棒
另外,php、nginx和xdebug都是用自制软件安装的。您可以尝试以下方法:
打开你的php.ini,抱歉,我不知道它在MacOS中的位置,在Ubuntu中它是打开的
/etc/php/7.0/fpm/php.ini
使用您喜爱的文本编辑器打开它,并具有保存配置文件所需的权限。
转到xdebug部分,检查是否已正确设置。在我的情况下,它看起来像下面。请注意,在您的情况下,xdebug.so的路径可能不同
[Xdebug]
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="\tmp"
xdebug.idekey="PHPSTORM"
xdebug.remote_autostart=1
xdebug.remote_host=192.168.10.10
xdebug.remote_mode=req
xdebug.remote_connect_back=1
xdebug.max_nesting_level=200
xdebug.var_display_max_depth=1000
xdebug.var_display_max_children=256
xdebug.var_display_max_data=4096
;this line below to prevent debug stop timeout
request_terminate_timeout=600s
在php.ini中要检查的另一件事是
max_execution_time = 600
我已将其设置为秒,如上所述,以防止停止调试会话。默认情况下,它设置为30秒
接下来需要检查的是我添加到主nginx.conf http部分的nginx配置
http {
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
fastcgi_read_timeout 600s;
proxy_read_timeout 600s;
fastcgi_buffers 8 16k;
fastcgi_send_timeout 600s;
fastcgi_buffer_size 32k;
#other standard settings below...
我添加它们是为了给我更多的时间调试会话,这样它就不会在600秒内停止
毕竟是编辑。
重新启动php7.0-fpm和nginx。
我不确定它是如何在Ubuntu的MacOS中完成的,它是通过以下方式完成的:
sudo service php7.0-fpm reload
sudo service php7.0-fpm restart
sudo service nginx reload
sudo service nginx restart
重新加载然后重新启动可能有点过火,但需要投保:)
还可以查看nginx的error.log文件
在Ubuntu中,它们被放置在/var/logs/nginx/
出现错误。yourdomain.log
转到最后一行,看看发生了什么。
希望能有帮助
UPD:适用于将Homestead与ngrok
tunnel一起使用的任何人(例如ssh-R 3000:localhost:8000user@yourserver.domain
然后在公共站点上,您将nginx设置为端口80上某个域的反向代理,以从3000个域中读取数据(通过SSH隧道),从而将本地开发公开给internet
要启用调试,您需要注释掉行
xdebug.remote\u connect\u back=1
,或将其值设置为0
。否则xdebug将获得X-Forwarded-For
和其他标题,并尝试连接回nginx,但不连接到本地开发人员,调试将不会启动。我刚刚在这里发布了一个类似的问题:(唯一的区别是docker的使用,以及不同的php版本)