45

I have internal server errors on my POST requests. How can I debug them ? Is it something to set up in php.ini ? THe file is really big and the word 'error' is met there many-many times.

myadmins
  • 459
  • 1
  • 4
  • 3

2 Answers2

74

You can turn on your PHP errors with error_reporting:

error_reporting(E_ALL);
ini_set('display_errors', 'on');

Edit: It's possible that even after putting this, errors still don't show up. This can be caused if there is a fatal error in the script. From PHP Runtime Configuration:

Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

You should set display_errors = 1 in your php.ini file and restart the server.

Devon
  • 32,773
  • 9
  • 61
  • 91
Philippe Signoret
  • 12,178
  • 1
  • 37
  • 55
27

Try writing all the errors to a file.

error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/php-error.log");

Something like that.

James Elliott
  • 982
  • 7
  • 20