Search code examples
phpamazon-ec2kohana-3

Having 500 Internal server error on any error on amazon hosting


I am working on amazon hosting using Kohana 3.x , PHP, and when there comes an error , it instead of showing error , it gives 500 internal server error. Due to which I have to debug my code on localhost but many times error come online only because many things can only be tested online then in that case I have to test it by commenting some part of code or line by line. So is there a way that instead of 500 internal server error it gives me actual PHP error or Kohana error that would be more helpful.

thanks in advance for your time guys.


Solution

    1. First of all never show PHP errors on a production website!
    2. Implement your own HTTP error pages - http://kohanaframework.org/3.2/guide/kohana/tutorials/error-pages
    3. Setup bootstrap.php for production:
      Kohana::$environment = Kohana::PRODUCTION;
      error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
    4. Kohana comes up with built in error logging feature. Every HTTP error (404, 403, 500 etc) is automatically saved in application/logs/month/day.php file. Open this file and check what was the reason for error.