i just want to say that i was getting a 500 error whenever i tried to run my script in PHP, but no error would show.

so if you are also getting a 500 error, its possible that the script is generating an error.

for example, on mine, i was getting a mysql error, i had the wrong password for the database i was using.