Setting PHP enviromental variable while running command line script

后端 未结 7 1398
情书的邮戳
情书的邮戳 2020-12-08 20:48

I need to run a PHP script from command line and I need to set some environmental variables. Unfortunately, following does not work:

php -dAPPLICATION_ENV=st         


        
7条回答
  •  一向
    一向 (楼主)
    2020-12-08 21:28

    I have the same situation and i use next code (it works for me):

    export APPLICATION_ENV=staging && php script.php
    

    Hope it will helpful for you too.

提交回复
热议问题