PHP error reporting: WordPress

Solution:

a 500 is a code error, or a server system error.

you can several things you can do to debug:

  • make sure you have full error reporting on in your php.ini (or at the top of the script)
  • try a simpler bit of code to make sure its not the server throwing the error.
  • use xdebug to step through the code until you find where its failing. Then use a try/catch to try to find out what the error actually was.
  • look in the server logs if you have access to them.
  • write proper unit tests (you do write tests yes?) for the sections of code you are using. Often its easier to isolate a problem with a unit test than it is when that code is part of a much larger application.
  • use echo’s and var_dumps to try to see where the code is falling over.

full error reporting. Put this at the top of your script if you dont have access to php.ini:

error_reporting(E_ALL);