<tfoot id='6bAdG'></tfoot>
    <bdo id='6bAdG'></bdo><ul id='6bAdG'></ul>
  • <i id='6bAdG'><tr id='6bAdG'><dt id='6bAdG'><q id='6bAdG'><span id='6bAdG'><b id='6bAdG'><form id='6bAdG'><ins id='6bAdG'></ins><ul id='6bAdG'></ul><sub id='6bAdG'></sub></form><legend id='6bAdG'></legend><bdo id='6bAdG'><pre id='6bAdG'><center id='6bAdG'></center></pre></bdo></b><th id='6bAdG'></th></span></q></dt></tr></i><div id='6bAdG'><tfoot id='6bAdG'></tfoot><dl id='6bAdG'><fieldset id='6bAdG'></fieldset></dl></div>

      <legend id='6bAdG'><style id='6bAdG'><dir id='6bAdG'><q id='6bAdG'></q></dir></style></legend>

      <small id='6bAdG'></small><noframes id='6bAdG'>

      1. 如何让 PHP 能够读取系统环境变量

        How to get PHP to be able to read system environment variables(如何让 PHP 能够读取系统环境变量)
      2. <legend id='rRhZU'><style id='rRhZU'><dir id='rRhZU'><q id='rRhZU'></q></dir></style></legend>
      3. <small id='rRhZU'></small><noframes id='rRhZU'>

          • <bdo id='rRhZU'></bdo><ul id='rRhZU'></ul>
              <tbody id='rRhZU'></tbody>

            • <i id='rRhZU'><tr id='rRhZU'><dt id='rRhZU'><q id='rRhZU'><span id='rRhZU'><b id='rRhZU'><form id='rRhZU'><ins id='rRhZU'></ins><ul id='rRhZU'></ul><sub id='rRhZU'></sub></form><legend id='rRhZU'></legend><bdo id='rRhZU'><pre id='rRhZU'><center id='rRhZU'></center></pre></bdo></b><th id='rRhZU'></th></span></q></dt></tr></i><div id='rRhZU'><tfoot id='rRhZU'></tfoot><dl id='rRhZU'><fieldset id='rRhZU'></fieldset></dl></div>

                • <tfoot id='rRhZU'></tfoot>
                  本文介绍了如何让 PHP 能够读取系统环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Centos 上使用 PHP 作为 PHP-FPM.我正在尝试遵循将设置存储在环境变量中的 http://12factor.net/ 准则.

                  I am using PHP as PHP-FPM on Centos. I am trying to follow the http://12factor.net/ guidelines of having the settings be stored in environment variables.

                  我在/etc/profile.d 中创建了一个文件,用于设置我想要的环境变量,并且当通过 Bash 在 CLI 中进行测试(即运行 bash 脚本)时会出现环境变量:

                  I have created a file in /etc/profile.d that sets the environment variables I want, and the environment variables appear when tested in the CLI via Bash i.e. running the bash script:

                  echo $SOME_SERVER_SETTING
                  

                  显示正确的输出.

                  我已将 clear_env 设置为 false 并将 variables_order 设置为 EGPCS,但是,我设置的变量也未显示在 PHP 中 getenv('SOME_SERVER_SETTING')或做 var_dump($_ENV)

                  I have set the clear_env setting to false and variables_order to EGPCS, however, the variable I have set does not show up in PHP either getenv('SOME_SERVER_SETTING') or doing var_dump($_ENV)

                  需要设置哪些其他设置以允许 PHP-FPM 接收所有服务器环境变量,尤其是通过 Centos 上/etc/profiles.d 中的 shell 脚本设置的那些?

                  What other setting needs to be set to allow PHP-FPM to receive all of the server environment variables, and in particular those set through a shell script in /etc/profiles.d on Centos?

                  推荐答案

                  安全原因:-)

                  参见 /etc/php5/fpm/pool.d/www.conf(debian 位置,在 CentO 上可能不同)

                  See /etc/php5/fpm/pool.d/www.conf (debian location, may be different on CentOs)

                  ; Clear environment in FPM workers
                  ; Prevents arbitrary environment variables from reaching FPM worker processes
                  ; by clearing the environment in workers before env vars specified in this
                  ; pool configuration are added.
                  ; Setting to "no" will make all environment variables available to PHP code
                  ; via getenv(), $_ENV and $_SERVER.
                  ; Default Value: yes
                  ;clear_env = no 
                  
                  ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
                  ; the current environment.
                  ; Default Value: clean env
                  ;env[HOSTNAME] = $HOSTNAME
                  ;env[PATH] = /usr/local/bin:/usr/bin:/bin
                  ;env[TMP] = /tmp
                  ;env[TMPDIR] = /tmp
                  ;env[TEMP] = /tmp
                  

                  这篇关于如何让 PHP 能够读取系统环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                      1. <small id='re6VX'></small><noframes id='re6VX'>

                          <tbody id='re6VX'></tbody>

                        1. <legend id='re6VX'><style id='re6VX'><dir id='re6VX'><q id='re6VX'></q></dir></style></legend>
                          <tfoot id='re6VX'></tfoot>

                            <bdo id='re6VX'></bdo><ul id='re6VX'></ul>
                            <i id='re6VX'><tr id='re6VX'><dt id='re6VX'><q id='re6VX'><span id='re6VX'><b id='re6VX'><form id='re6VX'><ins id='re6VX'></ins><ul id='re6VX'></ul><sub id='re6VX'></sub></form><legend id='re6VX'></legend><bdo id='re6VX'><pre id='re6VX'><center id='re6VX'></center></pre></bdo></b><th id='re6VX'></th></span></q></dt></tr></i><div id='re6VX'><tfoot id='re6VX'></tfoot><dl id='re6VX'><fieldset id='re6VX'></fieldset></dl></div>