Support » Fixing WordPress » Ajax 500 Errors

  • For some reason, I’ve been running into a whole lot of “Error 500” related to /wp-includes/admin-ajax.php during the past couple of days, to the point that even my dashboard widgets (incoming links & plugins) are throwing the errors now.

    Here’s what I’ve tried:

    * Disable all plugins – no luck.
    * Change theme – no luck.
    * Remove the entire /wp-admin and /wp-includes directories and reupload them from stock install – no luck.
    * Replace stock jquery with Google Ajax Libraries API CDN.

    My webhost doesn’t offer too detailed logs about stuff like this, so all I can see is that there’s an error 500, not what’s causing it. My console in Chrome tells me, for example:

    GET 500 (Internal Server Error) jquery.js:2
    send jquery.js:2
    p.extend.ajax jquery.js:2
    p.fn.load jquery.js:2
    (anonymous function) dashboard.js:1

    Any thoughts or ideas?

Viewing 9 replies - 1 through 9 (of 9 total)
  • I replaced jquery.js with the un-minified version, and narrowed down the problem to this line:

    // Do send the request
    // This may raise an exception which is actually
    // handled in jQuery.ajax (so no try/catch here)
    xhr.send( ( s.hasContent && ) || null );

    However, since it refers to jQuery.ajax, I’m not sure exactly how to narrow it down further.

    Any ideas? This is throwing a couple of really weird errors my way of late. For example, WP-Polls occasionally believes that people haven’t voted, but if they try to do so, it just tells them that it “Failed To Verify Referer”.

    Why is this marked as resolved?!

    I’m getting the same but only on one server so I am questioning the server set up.

    I had a similar issue, and couldn’t figure it out. For me, I finally checked the error logs and found a couple errors that were the cause.

    jcow, I’m not sure if you actually read my initial message, where I said quite clearly that “My webhost doesn’t offer too detailed logs about stuff like this, so all I can see is that there’s an error 500, not what’s causing it.”

    Qliphoth. You have to find the error in your code. It is the only way to get to the bottom of it. Unfortunately wp-ajax.php doesn’t really allow errors through, which is frustrating, but there is probably a good reason…

    Here are some options:

    • Get a new host. Sounds like you should do this in the near future.
    • Get access to a new host temporarily to run your site and script, or run it on a localhost server.
    • Make some changes to your script so that you can visit it through the browser to test it.
    • Use a manual method of running it through a jquery $.ajax call (or post, get, etc.) instead of through wp-ajax.php.

    Nobody can tell you what is wrong with your code without seeing it, and it is likely that there is an error in your code somewhere. So you will need to track that down or eliminate that as a possibility first.

    The error for me was purely a folder permssions problem. Some servers are more fussy about their permissions.

    I.e should the folder be 644 or 744 as an example.

    Thank this post from nelson.grin , super life saver. If your server just isn’t serving up that admin-ajax.php data, this is probably why, forget everything else. Original Article

    I was checking the apache error log and I found this:
    PHP Fatal error: Call to undefined function curl_init() in /var/www/teste/wp-content/plugins/ajax-for-all/inc/admin.php on line 229

    I installed php5-curl library:
    sudo apt-get install php5-curl
    and restarted apache server

    and now it works!!!

    My recomendation for you is to explain that php5-curl library must be installed for this to work.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Ajax 500 Errors’ is closed to new replies.