Fixing 500 Internal Server Error when importing blog posts to WordPress

0.00 avg. rating (0% score) - 0 votes

If you are attempting to import posts from other blog platforms, for example Google’s Blogger, to WordPress and encounter a 500 Internal Server Error, this post lists down some configuration settings you can change to avoid the issue.

1. Disable WordPress email notifications

Believe it or not, the default WordPress setting to send out notification email for every new post can cause this issue, especially when you are using SMTP to send email (and not localmail) via a plugin such as Easy WP SMTP, as each attempt to send an email will take around 2-3 seconds for a response from the SMTP server, slowing down the import process which is bound by the PHP’s max_execution_time parameter which defaults to 30 seconds on many platforms. To fix this, go to Notification emails under your WordPress settings and disable all the email notification options prior to the import. If that does not work and you still receive emails for new posts generated during import, consider installing a plugin such as Disable Emails to stop all outgoing emails before trying again. The import process should now be faster as emails are no longer being sent out. When you are finished, remember to restore the original email configuration as needed.

2. Check PHP timeout settings

There are quite a few parameters to change, but among those improper values for max_execution_timepost_max_sizeupload_max_filesize will most likely cause the import to fail prematurely when there are a lot of posts. Just set these to some very large values and try the import again. Remember to change them back after you are done, otherwise your site may be insecure and vulnerable to hacks.

3. Change PHP handler settings

If the above two suggestions do not work for you and you are still getting a 500 error (or some other 5xx timeout related errors), check your server logs to know exactly what caused the problem. In my case, the error was caused by an eventually timeout in FastCGI, the default PHP engine for Bluehost VPS accounts, as shown in the log

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

The only solution is to change the FcgidIOTimeout settings in /etc/httpd/conf.d/fcgid.conf to some large value, as described in this StackOverflow post. However if you are on a managed hosting account using cPanel or WHM, this can be quite tricky as changing the configuration may cause undesired effects. An easier way would be to change the PHP handler from FastCGI to some other handler, for example suphp, which does not have such a timeout setting. This can be easily done from the WHM interface:


After changing the PHP handler, try the import again and everything should work fine. When all the posts have been imported, you should set back FastCGI as the default PHP handler, which is very efficient compared with other options (CGI, suphp, etc.) and your WordPress site should continue to run normally.



A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>