Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:18:08+00:00 2026-06-04T19:18:08+00:00

I have EC2 tools installed under ubuntu user on a Amazon EC2 machine and

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:18:10+00:00Added an answer on June 4, 2026 at 7:18 pm

    Why don’t you either:

    • Use the php function putenv (http://php.net/manual/en/function.putenv.php) to set the environment variable EC2_HOME before using shell_exec.
    • Get the web server to set the EC2_HOME env variable. (“SetEnv” for apache, if using fastcgi and nginx then use “fastcgi_param EC2_HOME /somelocation”)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Amazon EC2 Machine running Ubuntu 10.04. The default user, ubuntu's .bashrc
I have an EC2 machine with ubuntu installed. I sort of messed up my
I have an Amazon ec2 instance running, and I have a non-root user set
We're looking into developing a product that would use Amazon's cloud tools (EC2, SQS,
I have an ec2 instance running on amazon which has AMI(ami-1b814f72).Its running RedHat 4.4.4-13
I have two amazon ec2 instances, (1) using SLES and running my current site,
I have server instance running on amazon ec2. I want to forward from port
I have previously setup a EC2 instance on Ubuntu 10.04 and setup the necessary
I have created an Amazon EC2 Instance that provides Windows Server 2008 with SQL
I have created ubuntu 10.04 ec2 image and now I need to install tomcat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.