【问题标题】:PHP_VALUE in nginx.conf doesn't override parameters in php.ininginx.conf 中的 PHP_VALUE 不会覆盖 php.ini 中的参数
【发布时间】:2018-04-05 11:59:52
【问题描述】:

我在 nginx.conf 中有这个位置部分:

location ~ \.php {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param   PHP_VALUE   "memory_limit = 500M; post_max_size = 400M; upload_max_filesize = 300M";
            fastcgi_param SCRIPT_NAME $fastcgi_script_name;
            fastcgi_index index.php;
            fastcgi_pass 127.0.0.1:9000;
}

我需要增加这些参数以进行文件下载,但phpinfo()-list 中仍有以前的 php.ini 值,尽管更新了 $_SERVER['PHP_VALUE'](包含我在配置中编写的值) .我试图以不同的方式更改值:没有分号,使用\n,混合了以前的两种变体,用PHP_ADMIN_VALUE替换了PHP_VALUE,从其他人的配置中复制了参数;但它仍然不成功。问题出在哪里?应用我的参数有什么障碍?

【问题讨论】:

  • 我也没有忘记重新加载/重启nginx
  • 哪个操作系统以及什么版本的 PHP 和 FPM?您是否也尝试过重新启动 FPM?
  • 哦,我在 Windows 上通过 php-cgi 完成,就像 there
  • 你做的是PHP-FPM,不确定PHP-CGI是否也支持

标签: php nginx config fastcgi php-ini


【解决方案1】:
fastcgi_param   PHP_VALUE   "memory_limit = 500M; post_max_size =
400M; upload_max_filesize = 300M";

最后一个参数没有分号

fastcgi_param   PHP_VALUE   "memory_limit = 500M; post_max_size = 400M; upload_max_filesize = 300M;";

【讨论】:

    【解决方案2】:

    对我来说,它以这种格式工作 -

    fastcgi_param PHP_VALUE "variable1=value1;\n variable2=value2; \n variable3=value3;";
    

    【讨论】:

      猜你喜欢
      • 2022-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多