skip to Main Content

So I decided to play with Amazon AWS and created a PHP application on Elastic Beanstalk. I went with the sample application which is automatically created for you.
My instance started fine, I could see the sample website but I also noticed the sample php file had another functionality: if you would send a POST request it would log it in a file.

enter image description here

This would be saved to /tmp/sample-app.log.

So I used curl to send some POST requests to my application (ie. curl -X POST )
Then I used putty to log into the EC2 instance associated to the Beanstalk instance (by creating a key pair) and looked in the /tmp folder, there was no sample-app.log.
Actually I did a search in / for all files ending with log and I couldn’t find sample-app.log.

What am I doing wrong?

2

Answers


  1. I would put the response of the file_put_contents method in a variable and check for errors, i.e.

    $error = file_put_contents(...);
    if (!$error) {
       // report or log error here
    }
    

    The method returns false on errors.

    I think it is a permission issue, but I can’t really tell without any error message.

    Login or Signup to reply.
  2. Try the whole thing again. Setting a key pair will result in reprovisioning. This is now a new EC2 instance, so you won’t find the file from before in it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search