Wordpress Backups - Importing Files Larger Than 2MB

When doing wordpress backups, there are different ways to do it. You can do database backups in your hosting account c-panel or PhpMyAdmin, but that might not be enough to guarantee your safety. In the wordpress control panel, under manage, you can export an xml file which contains your posts, pages, comments, custom fields, categories, and tags. Now, when you try to import that file because of whatever reason, importing files larger than 2MB is not possible. Most exported back ups are larger than 2MB, so how can you do it?

How To Import Larger Files

In your c-panel’s file manager, or using FTP, there should be a file called php.ini in your public html directory. If there is not, you can create one with phpconfig in your c-panel. If your’s doesn’t offer that, I’ll be happy to send you a basic php.ini file you can use.

For example, your exported xml backup is 12MB. Copy php.ini into notepad or another text editor. Find the line that says:

Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Change the value to 15M to compensate. You will now need to put the altered version (still titled php.ini) in your /public_html/wp-admin directory. You will now see the amount listed in your WP control panel under import is changed to 15. Go ahead and import. Sometimes, it still may not import all your posts and comments because of a max execution time out. That’s what happened to me - it only imported half of my posts. To fix this, you’ll need to edit php.ini again. Go to the lines:

max_execution_time = 30     ; Maximum execution time of each script, in seconds

Change 30 to 120 in max execution time, and it should do the trick. Once your file has been successfully imported in full, delete that php.ini file in your wp-admin folder. You may have to use a larger number if your backup is huge.

Check Your Permalink Structure

If you move to a new host, or you delete your blog so you can do a fresh install, make sure you use the same exact permalink structure from your previous site or you’ll lose all incoming links and pagerank. This blog is a brand new wordpress install on a brand new c-panel and server. I had to change my permalinks from the default to match my old site.

Once you’ve started a wordpress blog and written a lot of posts, DO NOT change your permalinks unless you know how to write a permanent 301 redirect in your htaccess file - you will lose all incoming links to your posts.

Use a Variety of Backups

You should download backups from your cpanel as your main method. Do it everyday and after every new post. These are saved as sql files and you should store them in a specific file on your computer. Save them on your computer and on your host’s server. It’s always possible that someone could hack into your c-panel (the worst possible kind of hack) and add whatever evil scripts they like. That’s where your downloaded backups come in handy. Change your c-panel password often and make sure your wordpress install uses a strong password too.

You should also export xml backups as a second safety measure because you never know what might happen. In my case, all my sql backups were useless, so I was thankful I saved those xml exports. You can never be too careful. A server can be hacked, get a virus or the building your host is in could burn down. Entrecard’s host recently had a fire, so you never know.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon

Related Posts

Comments

9 Responses to “Wordpress Backups - Importing Files Larger Than 2MB”

  1. Scam on July 18th, 2008 5:38 pm

    Thanks for that Bobby - it is EXACTLY what I have been looking for and wish I’d had some months ago!

    Now.. all I need to do now is work out how to extract my posts from a downloaded .sql file as I have found another old backup I had downloaded and just want the last 2 months worth of work out of it..

  2. Revellian on July 18th, 2008 6:05 pm

    Cool deal scam, I’m glad it helped! The way you can do that is:

    Create a test wordpress install in a subdirectory. Import that old sql file into that test blogs database in phpmyadmin. Then open your test blog and export a xml back up (delete the hello world post 1st). Then import that same xml file into your current blog, it will not overwrite anything, but will add in the new posts and any old comments and tags :smile:

  3. Scam on July 18th, 2008 7:14 pm

    I didn’t realise that it wouldn’t overwrite anything - that’s gonna save me a lot of time - thanks!!

  4. Rajeev Edmonds on July 19th, 2008 12:13 am

    Hi Bobby,

    (Security Advice)

    Remove the following tag from your code.

    Do not show the version of WP you are using. And I checked your login page. Use login-lockdown plugin to lock out session if multiple unsuccessful login attempts are made from any IP. Don’t worry, this plugin won’t inflate your DB ;) I am using it for long time. It’s light and works quietly.

    Mintblogger

  5. Rajeev Edmonds on July 19th, 2008 12:14 am

    The tag I wrote in previous comment didn’t showed up. It’s tag showing the version of your WP.

    meta name=”generator” content=”WordPress 2.6″

  6. Revellian on July 19th, 2008 5:37 am

    @Rajeev: Thanks! I used to remove that tag, but every time you upgrade, it adds it back in. I installed that plug in just for safe measure. My comments don’t allow code.

    I found a killer script at:

    http://www.village-idiot.org/archives/2008/04/03/wordpress-capturing-_post-requests/

    It allows you to save detailed post comment requests in a file above public_html. Only you can see it. You can analyze exactly what spammers are trying. If you ever get exploited, you’ll have a record to use in doing forensics :mrgreen:

  7. emila on July 24th, 2008 10:20 am

    Thanks for the tutorial, Bobby!

  8. Revellian on July 24th, 2008 12:38 pm

    You’re welcome Emila! This particular method DOES NOT back up pictures, just the post and comment text. This is a last resort back up, when the normal backups don’t work. I lost all my pictures when I did it. I now back up my pictures by downloading then through FTP as a safety measure.

  9. Laarni on August 14th, 2008 1:10 am

    Same problem here. My xml reaches 2.53 mb. I can’t find the php.ini you are talking about. Can you send me one or how to create one?

    The only thing I found on my cpanel is “View PHP Configuration”

    Thanks!

Leave a Reply