PHP error reporting: WordPress

Solution:1

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);

Solution:2

You can view the error by accessing the Apache error log file for your virtual host.

If your virtual host is called example.com, then your error log file should be located at /var/www/vhosts/example.com/logs/error.log

Solution:3

Search your wordpress root for error_log file. Depending from your setup, it is there, or on your wamp stack log folder. Like already commented, 500 is not a PHP error but a server error, so you can’t get it printed out with PHP.