adamors adamors - 8 months ago 35
Ajax Question

PHP error [an error occurred while processing this directive]

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]

The php includes 2 files, the database connection info, and some initialization stuff. I used relative path, and both files are at the correct location, with correct permissions.

I checked the error log, and since there's nothing in there. I googled this, but nothing concrete came up, and ATM I have no idea how to get around this.
Please advise!


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 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:

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 access.log and error.log and see if they contain messages related to this issue.

Hint: tail -f xxx.log allows you to track changes in a log in real-time (very useful for debugging).