2

Currently my web application can print error when host on my local machine.

When I host it on Amazon EC2 server. The error page is empty/blank.

I want to see the error stack trace when run on EC2, how can I do that?

I'm using Ubuntu Natty 11.04 and LAMP Stack on my EC2.

2 Answers 2

2

Can you post the contents of php.ini? This looks like a configuration issue. We will need to check that the web server can find the error log you defined in php.ini and that the web server has permissions to write to it. PHP silently fails if either condition isn't met...

4
  • code.namgivu.com/index-phpinfo.php is my phpinfo
    – Nam G VU
    Dec 13, 2011 at 18:28
  • 1
    You're not specifying an absolute path to the error log. This means that the webserver will asume that the error log is in document_root. (Someone correct me if I'm wrong)Try putting in path to the apache logs dir, restarting the server, and see if you get output.
    – Mina
    Dec 15, 2011 at 11:58
  • @Mideiane I appreciate your help a lot. Though, if it were with more full information, I'll choose your answer as accepted. Thank you a lot! It's now works with full path.
    – Nam G VU
    Jan 18, 2012 at 14:04
  • @NamGiVU hm. OK.
    – Mina
    Mar 9, 2012 at 13:45
2

Open the php.ini file and change the following directives so it looks like this.

display_errors = On
error_reporting = E_ALL

Then restart Apache and do something to cause an error, such as manually call trigger_error('Test'); on a page.

You should be aware this is bad practice for a production website. These settings are fine in dev, where you want errors to be blatantly obvious, but for production you should be logging errors to a file which you review. This log file is defined with the error_log directive.

3
  • It's great. I think I better go with the error_log option.
    – Nam G VU
    Dec 11, 2011 at 9:01
  • I tried to alter my php.ini at /etc/php5/apache2/php.ini to include error_log = php_errors.log, display_errors = On, error_reporting = E_ALL; then I restart Apache via sudo /etc/init.d/apache2 restart. Then I refresh the error page: I can see the error printed on my web but I found no lines in /etc/php5/apache2/php_errors.log. Please help
    – Nam G VU
    Dec 11, 2011 at 9:03
  • The error in your page is identical to what you'd get in the error log anyways.
    – thinice
    Dec 12, 2011 at 15:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .