I have a php script that searches a database based on some filters and echoes back the number of results. I request this file with ajax, to be able to display the number of results the search returns right after the user changes some selects.
This works just fine on a local host, but it doesn't on a production server, and since I had no idea what was wrong (no visible errors) I called the php script directly, to see whether it has any errors or not. what I get is
<!-- SHTML Wrapper - 500 Server Error -->
[an error occurred while processing this directive]
Step 1: Enable Error Printing in PHP
In order to find out the bug, enable errors for your PHP.
If that doesn't work, edit php.ini (see http://php.net/manual/en/errorfunc.configuration.php) and set:
If you don't know where your php.ini is located use:
<?php phpinfo(); ?>
And locate "configuration file (php.ini) path". For visual instructions, see: http://www.php-scripts.com/20050909/8/
Step 2: Debug your Apache / Web Server Log
If you still don't get any errors in PHP, the problem has to be with web server:
If you are using Apache, locate
error.log and see if they contain messages related to this issue.
tail -f xxx.log allows you to track changes in a log in real-time (very useful for debugging).