Error in code results in admin-ajax.php 500 error
<p>I don't know if this is something recent that WordPress changed or not, but usually, when I was writing a function that is used as an action for ajax call (on front end), if I had some error in my code (missing <code>;</code>, or unclosed <code>}</code> or whatever), I would get my ajax call returned in the Network tab in Chrome inspector, and when I'd select my <code>admin-ajax.php</code> and see the <code>Preview</code> or the <code>Response</code> tab, I'd see the error code written out.</p>

<p>Maybe a month ago or so, when I had an error in my code (I used undefined function in my callback function), all I got in the inspector was 500 error that pointed to the <code>$.ajax()</code> code in my <code>.js</code> script, with this</p>

<p><a href="https://i.stack.imgur.com/t0lJG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t0lJG.jpg" alt="enter image description here"></a></p>

<p>Nothing. I was sure this was a server issue, and send mails to my host, asking them about it. They didn't know what it was either. Finally I found out that I can write my error messages with</p>

<pre><code>ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
</code></pre>

<p>and there I saw I had some errors in my callback function. Once I fixed that, the code worked.</p>

<p>But the thing is, usually I would see the error in my <code>Response</code> tab (or <code>Preview</code>). I'd see it, fix it and it worked.</p>

<p>I'm asking this because on some servers the above method with writing to <code>error_log.txt</code> takes a while. I am working on a client server that is on CentOS and error log appears in my wp root folder maybe 10 minutes or so after the error - which is not practical.</p>

<p>Did they change something in the core files regarding the ajax?</p>