1

I need a script to set the SERVER variables programatically when executing a PHP script from the CLI.

The idea is to get the SetEnv lines from an apache config file and feed them into the cli execution of the script so that the CRON job can execute with the same environment variables as the web site.

I have the following command

envvars=grep SetEnv $conffile | awk '{print $2"=\""$3"\"";}' | xargs
$envvars php $script

which should execute

arg1="value1" arg2="value2" php somescript.php

But I get the response

arg1=value1: command not found

If I just echo the command I can execute it without a problem.

QUESTION: Why does my bash script not work?

Matt
  • 1,142

0 Answers0