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

by Yang Yang on April 22, 2009

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.

Llynix June 27, 2009 at 2:43 am

For me it was curl_exec() that triggered this error.

Bonjiro July 30, 2009 at 2:29 am

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.

Yang Yang August 6, 2009 at 9:32 am

Actually it turns out that it’s caused by Mod_security an apache security module.

Gonimadia November 25, 2009 at 11:54 pm

Oh my god enjoyed reading your article. I submitted your rss to my google reader.

Yang Yang January 26, 2010 at 1:31 pm

Sure glad you did. Thanks for subscribing!

Brandon February 27, 2010 at 6:17 am

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.

Yang Yang February 27, 2010 at 9:59 am

Hey, no problem, Brandon.

Vipul October 13, 2010 at 2:53 pm

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.

Yang Yang October 14, 2010 at 8:03 am

Anywhere would do, just insert them in the .htaccess at the root of your site.

Comments on this entry are closed.

{ 1 trackback }

Previous post:

Next post: