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

      <legend id='fiejI'><style id='fiejI'><dir id='fiejI'><q id='fiejI'></q></dir></style></legend>

        AWS Elastic Beanstalk:运行 Cron.d 脚本,缺少环境变量

        AWS Elastic Beanstalk: Running Cron.d script, missing Environment Variables(AWS Elastic Beanstalk:运行 Cron.d 脚本,缺少环境变量)

            • <bdo id='pfubs'></bdo><ul id='pfubs'></ul>
              <legend id='pfubs'><style id='pfubs'><dir id='pfubs'><q id='pfubs'></q></dir></style></legend>

              • <small id='pfubs'></small><noframes id='pfubs'>

                <i id='pfubs'><tr id='pfubs'><dt id='pfubs'><q id='pfubs'><span id='pfubs'><b id='pfubs'><form id='pfubs'><ins id='pfubs'></ins><ul id='pfubs'></ul><sub id='pfubs'></sub></form><legend id='pfubs'></legend><bdo id='pfubs'><pre id='pfubs'><center id='pfubs'></center></pre></bdo></b><th id='pfubs'></th></span></q></dt></tr></i><div id='pfubs'><tfoot id='pfubs'></tfoot><dl id='pfubs'><fieldset id='pfubs'></fieldset></dl></div>
              • <tfoot id='pfubs'></tfoot>
                  <tbody id='pfubs'></tbody>
                1. 本文介绍了AWS Elastic Beanstalk:运行 Cron.d 脚本,缺少环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试运行由 cron 脚本(在 cron.d 中)触发的 PHP 脚本.该脚本已正确触发,但缺少存储在 $_SERVER 超全局变量中的 Elastic Beanstalk环境变量".该脚本目前以用户root"身份运行,但它不在具有环境变量的同一环境中.变量设置正确,如果我从完整的 shell 运行脚本,它运行得很好.

                  I'm trying to run a PHP script that is triggered by a cron script (in cron.d). The script is triggered properly but it is missing the Elastic Beanstalk "Environment Variables" that are stored in the $_SERVER superglobal. The script is being run as the user "root" for now, but it's not in the same environment that has the environment variables. The variables are set correctly, if I run the script from a full shell it runs just fine.

                  这些变量的导出"在哪里?他们在哪里设置?我在/etc/apache/conf.d/aws_env.conf 中找到了 Apache 的 SetEnvs.我在用户的 .bashrc、.bash_profile 等文件中找不到任何内容.有解决方法吗?有更好的方法吗?

                  Where are the "exports" for these variables? Where do they get set? I found the SetEnvs for Apache in /etc/apache/conf.d/aws_env.conf. I can't find anything in the user's .bashrc, .bash_profile, etc. Is there a workaround? A better way to do this?

                  谢谢.

                  推荐答案

                  我刚刚发现这个,使用

                  grep -r "export MY_VAR" /
                  

                  亚马逊似乎不时移动文件位置.当前位置是:

                  Amazon seems to move the file location from time to time. Current location is:

                  /opt/elasticbeanstalk/support/envvars
                  

                  所以我想我会在调用我的 php 脚本之前在我的脚本中包含 (source [file path]) .似乎仍然是一种时髦的做事方式.我仍在寻找更好的解决方案.

                  So I think I'll just include (source [file path]) that in my script before calling my php script. Still seems like a funky way to do things. I'm still in for better solutions.

                  我通过 cron 触发的 bash 脚本运行 PHP.所以要设置环境,我会做这样的事情:

                  I was running PHP via bash script triggered by cron. So to setup the environment, I would do something like this:

                  #!/bin/bash 
                  source /opt/elasticbeanstalk/support/envvars
                  php -f my-script.php
                  

                  有关 PHP 解决方案,请参阅下面@userid53 的回答.

                  See @userid53's answer below for PHP solution.

                  这篇关于AWS Elastic Beanstalk:运行 Cron.d 脚本,缺少环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)

                2. <i id='VzgLB'><tr id='VzgLB'><dt id='VzgLB'><q id='VzgLB'><span id='VzgLB'><b id='VzgLB'><form id='VzgLB'><ins id='VzgLB'></ins><ul id='VzgLB'></ul><sub id='VzgLB'></sub></form><legend id='VzgLB'></legend><bdo id='VzgLB'><pre id='VzgLB'><center id='VzgLB'></center></pre></bdo></b><th id='VzgLB'></th></span></q></dt></tr></i><div id='VzgLB'><tfoot id='VzgLB'></tfoot><dl id='VzgLB'><fieldset id='VzgLB'></fieldset></dl></div>
                    <tbody id='VzgLB'></tbody>
                  <legend id='VzgLB'><style id='VzgLB'><dir id='VzgLB'><q id='VzgLB'></q></dir></style></legend>

                    <bdo id='VzgLB'></bdo><ul id='VzgLB'></ul>

                    <tfoot id='VzgLB'></tfoot>

                    <small id='VzgLB'></small><noframes id='VzgLB'>