Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

EasyWechat默认日志输出到CGI,导致502 #1993

Closed
lillian-who opened this issue Dec 15, 2020 · 2 comments
Closed

EasyWechat默认日志输出到CGI,导致502 #1993

lillian-who opened this issue Dec 15, 2020 · 2 comments

Comments

@lillian-who
Copy link

我用的环境

  • PHP 版本:
  • overtrue/wechat 版本:4.3.1
  • 是否使用了框架?框架名称:Yii2.0
  • 服务器:Nginx

问题及现象

项目接口调用 openPlatform->code_template->list()获取获取小程序模板列表时,报502错误。

检查过fpm网关和Nginx日志,发现,接口返回的header里把微信接口返回的信息带上了,导致header过长,无法正常返回:

upstream sent too big header while reading response header from upstream

代码片段:

配置:

       $config = [
            'app_id' => 'xxx',
            'secret' =>  'xxx',
            'token' => 'xxx',
            'aes_key' =>  'xxx',
        ];
        
        $this->openPlatform = Factory::openPlatform($config);

接口调用(关键代码):

$result = $this->openPlatform->code_template->list();
$result['template_list'] = [current($result['template_list'])];
//在此处写入log到数据库,result数据正常写入
//...此处省略写数据库log查错的代码
return $result;

在配置中添加日志配置log后,问题才得到解决。

希望做以下修改:

  1. 默认不要开启debug
  2. 日志不要输出到cgi
@overtrue
Copy link
Collaborator

@haohetao
Copy link

这个应该是nginx也有bug
docker-library/php#878

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants