我正在使用最新版本的PHP(7.0.2)和xdebug(2.4.0RC3)与phpstorm 9.0.2,当我开始调试时,我立即得到了
<code>error "502 Bad Gateway" </code>
有时我会设法通过几行代码,但无论如何我都会得到错误.
当我有以前版本的PHP(5.6)和xdebug时,一切都很棒.
附: php,nginx和xdebug都是用自制软件安装的.
解决方法:
你可以试试这个:
打开你的php.ini,对不起,我不知道它放在MacOS的哪个地方,在Ubuntu它已经打开了
<code>/etc/php/7.0/fpm/php.ini </code>
使用您喜欢的文本编辑器打开它,并使用所需的权限保存配置文件.
转到xdebug部分并检查是否已正确设置.在我的情况下,它看起来像下面.请注意,在您的情况下,xdebug.so的路径可能不同.
<code>[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 </code>
在php.ini中检查的另一件事是
<code>max_execution_time = 600 </code>
我已经在几秒钟内设置它,以防止默认情况下停止调试会话,它设置为30秒
接下来你需要检查的是nginx配置我已经添加到主nginx.conf http部分那些行
<code>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...
</code>
我已添加它们以给我更多时间进行调试会话,因此它不会在600秒内停止.
毕竟编辑完毕.
重启php7.0-fpm和nginx.
我不确定在Ubuntu中它是如何在MacOS中完成的,它是通过以下方式完成的:
<code> sudo service php7.0-fpm reload sudo service php7.0-fpm restart sudo service nginx reload sudo service nginx restart </code>
也许重新加载然后重新启动但是要保险是有点过分了:)
另请查看nginx的error.log文件
在Ubuntu中,它们被放在/ var / logs / nginx /中
有error.yourdomain.log
转到最后一行,看看发生了什么.
希望它会有所帮助.
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!