WordPress: 503 Service Temporarily Unavailable when Posting New Posts or Modifying Existing Posts

It’s weird that I encountered this problem that when you post new posts in WordPress, there’s a possibility that it may run into a 503 Service Temporarily Unavailable error without publishing the article at all.

I did some split tests and in this post, the string ‘fopen‘ which is a php function seems to be the culprit that prevents the post being posted, constantly causing the wordpress to make 503 service temporarily unavailable errors when you hit Publish or Update.

One workaround is to do the split tests on your posts and see which part of it is causing the problem so that you can change it to something else until WordPress accepts.

Haven’t notified the wordpress team yet, don’t know if they have received other complaints about this bug (or is it) or not, I think I’m just too lazy to send the report. Whatever… as long as you can get things done, doesn’t really matter if there’s a glitch.

Problem Solved

Update: Turns out this error is not alone in WordPress and not a bug of it at all. Some of the administration tasks of other CMS software such as posting posts with PHP code in them and uploading stuff would also trigger a module in Apache called Mod_security to be over sensitive. The solution is to disable the module (not recommended), or put a simple line into the .htaccess file of the site to tell Mod_security that:

  1. All requests from this particular IP address is absolved from being inspected and monitored by Mod_security module –
    SetEnvIfNoCase Remote_Addr ^123\.123\.123\.123$ MODSEC_ENABLE=Off
  2. All requests made to this specific PHP script is absolved of being checked for malicious attempts –
    SetEnvIfNoCase Request_URI ^/wp-admin/async-upload\.php$ MODSEC_ENABLE=Off

With WordPress, the potentially problematic scripts I know include:

  1. /wp-admin/async-upload.php
  2. /wp-admin/post.php
  3. /xmlrpc.php

So depending on the error you are getting from the task you are performing, insert one or two lines into the .htaccess to prevent any unnecessary 503 errors. Read more about this issue at DreamHost wiki.

10 thoughts on “WordPress: 503 Service Temporarily Unavailable when Posting New Posts or Modifying Existing Posts”

  1. Same thing for me – PHP’s curl_exec() triggers “Service Temporarily Unavailable”. Is it a bug or a security measure trying to squash exec()?

    I might try modifying the file via FTP. But then I probably wont be able to edit it the normal way anymore.

  2. I was trying to update the word press stats stats.php with my wordpress api key when this happened. You saved me a huge headache. Gracias.

  3. hI, Yang!

    Great post, buddy! Just little stuck somewhere.. As I am newbie, I don’t know much about networking and apache.

    I am getting this error, while I try to access my dashboard. It says: “503 Service Unavailable”. But it’s let me log in, I mean I can see /wp-admin page. But While it tries to go Dashboard it gives the error.

    I don’t know where to put the code, Would you please explain me where should I put it in .htaccess. I hope I made my point clear.

    Thanks in advance.

  4. Pingback: This blog post can make WordPress crash | Geekality

Comments are closed.

Scroll to Top