php_value php-fpm配置中的php_value的Env变量字符串不起作用

发布于 2025-02-09 19:55:46 字数 548 浏览 2 评论 0原文

我有一个php-fpm配置文件,

php_flag[display_errors] = ${PHP_DISPLAY_ERRORS}
php_value[error_reporting] = ${PHP_ERROR_REPORTING}
php_flag[log_errors] = ${PHP_LOG_ERRORS}

并定义了env变量:

PHP_DISPLAY_ERRORS=1
PHP_ERROR_REPORTING=E_ALL
PHP_LOG_ERRORS=1

如果我评论php_value [error_reporting] 一切都按预期工作(屏幕上会显示错误),但是当未被调音时,工作。

正如我一直在播放的那样,我似乎可以使用ENV可通过可vairable Via设置任何布尔值,但不能以相同的方式设置字符串值。

我还尝试了各种引用字符串的形式,并使用php_admin_value没有运气。阿米缺少什么。

跑步:Apache,PHP 7.3,PHP-FPM,Docker

I have a php-fpm config file with:

php_flag[display_errors] = ${PHP_DISPLAY_ERRORS}
php_value[error_reporting] = ${PHP_ERROR_REPORTING}
php_flag[log_errors] = ${PHP_LOG_ERRORS}

and ENV variables defined:

PHP_DISPLAY_ERRORS=1
PHP_ERROR_REPORTING=E_ALL
PHP_LOG_ERRORS=1

If I comment out php_value[error_reporting] everything works as expected (errors will be displayed on screen) but when un-commented, it doesn't work.

As I have been playing, it seems like I can set any boolean value using an ENV vairable via but cannot set string values in the same way.

I have also tried various forms of quoting the string and using php_admin_value with no luck. What amI missing.

Running: Apache, PHP 7.3, PHP-FPM, Docker

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧故 2025-02-16 19:55:46

首先,您应该运行

docker exec -ti your_image:tagged  env | grep "PHP_"

并查看实际设置在运行容器中。
当心,如果您尝试echo $ php_error_reporting它将返回空的env-var,因为没有入门点的外壳是sh,而不是<<代码> bash )

在我玩的时候,似乎我可以使用ENV VAIRable Via设置任何布尔值,但不能以相同的方式设置字符串值。

实际上应该是相反的:在Linux Shell脚本/扩展中,没有布尔类型,只有字符串。

首先尝试确保您的环境变量具有您期望的价值;然后从那里开始调试是否是FPM或INI文件的问题(尽管这不太可能)。

First you should run

docker exec -ti your_image:tagged  env | grep "PHP_"

and see what is actually set inside the running container.
(beware, if you try to echo $PHP_ERROR_REPORTING it will return empty env-var, because the shell with no entrypoint is sh, not bash)

As I have been playing, it seems like I can set any boolean value using an ENV vairable via but cannot set string values in the same way.

Actually should be the opposite: in Linux shell scripts/expansion there's no Boolean type, just Strings.

Try first to ensure that you environment variables have the value that you expect; then proceed from there in debugging whether is a problem with FPM or the INI file (although that's quite unlikely).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文