I have EC2 tools installed under ubuntu user on a Amazon EC2 machine and my shell scripts make use of these tools to update code on various environments. Now we have PHP sitting on top of these shell scripts and I am using shell_exec to execute these shell scripts from the web but I get the following error:
home/ubuntu/ec2-tools/bin/ec2-describe-instances: line 9: EC2_HOME: EC2_HOME is not set
I believe this is happening because PHP executes scripts as www-data and EC2_HOME is defined for ubuntu user. echo $EC2_HOME give me the right path from the command line when logged in as Ubuntu.
Can any one please help me how to successfully execute the shell scripts using PHP.
Thanks