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.
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:
- 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
- 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:
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.