I have some Ajax that has been working on a live site, now it has stopped working. The Ajax should be returning a page but is returning a 500 error (internal server error).
The strange thing is I can navigate and post to the page the Ajax is calling, so the page is only not working via an Ajax call ($.post).
Another strange thing is it is working fine locally, but not live. Also all the other Ajax on the site is working.
Anyone have the foggiest what this might be? By the way it’s all jQuery with CakePHP.
Edit:
The apache error logs are saying:
“Premature end of script headers: php-script, referer…”
Edit 2:
It all happened when I switched the server over to SSL. It says above error and then “Port 80”.
First off, this has nothing to do with jQuery, AJAX, POST, CakePHP, or HTTP headers. The complete error message is “Premature end of script”, which means that the PHP process that Apache is using to run the PHP script terminated unexpectedly (i.e., before the PHP process finished its part of the Fast CGI protocol). This generally means that the PHP process crashed or caused a “segmentation fault”.
PHP segmentation faults can be difficult to troubleshoot, and they should never happen; PHP should never crash. The reason why it is crashing could be due to a number of things. Maybe it is a simple fix, though.
The first thing that I would do is completely uninstall PHP and install the latest stable version. If you are running PHP 5.3 and Windows, then you should only use the VC6 binaries (the “VC6 x86 Thread Safe” package); the VC9 package will cause PHP to crash when used by Apache. Reinstalling might fix your problem because extension DLLs/SOs of older releases of PHP might still exist in your extensions directory on the live server.
If on Windows and using MySQL, the next thing that I would do is make sure that the MySQL
bindirectory is in the live server’sPath. The reason for doing this is to make sure thatlibmySQL.dllcan be “found” by the OS. You should be able to SSH into the live server, typemysql --help, and see the MySQL CLI client’s usage message. Restart Apache if you add the MySQLbindirectory toPath.If both of these suggestions do not solve the problem, then please update your question with answers to the following:
dl?UPDATE: With version 5.3.6 and later, the PHP project no longer releases “VC6” installers. The recommendation is to install a build of Apache HTTPD from Apache Lounge and use a “VC9” installer.