If you're looking to debug your php code you'll want to run tail -f /var/log/apache2/error.log this will have detailed information about why the 500 error was triggered.
Here is an example from my error log that recently threw a 500 error
[Sun Sep 11 22:54:16 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function sql_query() on a non-object in /home/marco/Projects/Ondina/cp/apps/domains/databases.d.php on line 170
This shows the file source that threw the error, the line, and the exact error message. From those three variables you should be able to locate and fix any issues with your code.