Title: SimplePHPBlog import utility
Last modified: August 18, 2016

---

# SimplePHPBlog import utility

 *  [willhn](https://wordpress.org/support/users/willhn/)
 * (@willhn)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/)
 * I have been using SimplePHPBlog for many years and decided I wanted to use WordPress.
   I tried the RSS import feature but this simply didn’t work. So, I wrote a perl
   script to do it for me. Basically, it scans a SimplePHPBlog directory and stuffs
   all entries into the MySQL database in WordPress format.
 * Download it here:
    [http://www.qualtersystems.com/public/WordPress/WordPressImport.pl](http://www.qualtersystems.com/public/WordPress/WordPressImport.pl)
 * Hope it is useful – any feedback for bugs and improvements appreciated!

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/simplephpblog-import-utility/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/simplephpblog-import-utility/page/2/?output_format=md)

 *  [teknics](https://wordpress.org/support/users/teknics/)
 * (@teknics)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-654990)
 * What about a brief tutorial for the perl inept?
 * My specs:
 * Want to run this on a brand spankin new WP install
    SPHPBlog installed in /root
 * Do I edit your login/pass info with my already set db info? And change where 
   my SPHPBlog data is on the server?
 *  [luisalcaraz](https://wordpress.org/support/users/luisalcaraz/)
 * (@luisalcaraz)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655000)
 * Great job, willhn !!
    This was just what I was looking for! I found only one 
   problem… When I try to import a post with multiple categories, your program crashes.
   This is the error:
 *     ```
       Use of uninitialized value in concatenation (.) or strig at C:\path\WordPressImport.pl line 293.
       lost category '' at c:\Path\WordPressImport.pl line 293.
       ```
   
 * Thanks!!
 *  [teknics](https://wordpress.org/support/users/teknics/)
 * (@teknics)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655001)
 * Luisalcaraz,
 * I experienced the same error and emailed William. He said he was going to look
   at the files I sent him and work on a fix. We are the first and second to try
   the script.
 * However, looking with more detail now – the script gives me that error after 
   importing about 7 posts. I double checked and none of these posts have multiple
   categories.
 * What version of the sphpblog are you running? I was using 0.5.0.
 *  [luisalcaraz](https://wordpress.org/support/users/luisalcaraz/)
 * (@luisalcaraz)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655002)
 * Hi teknics,
 * I’m using 0.4.8
    I have the same error when the post has no category. You can
   check that.
 *  [teknics](https://wordpress.org/support/users/teknics/)
 * (@teknics)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655003)
 * Luisalcaraz,
 * I found one with no category as well, it was the 8th post. I fixed it and re-
   ran the script and it still gave me an error. William emailed me a script he 
   repaired, and it got further – but still stopped way short of my total entries(
   a little more than half imported).
 * There is a pretty big time difference between William and I, I believe he will
   be getting home from his “real” job in the next hour or so.
 *  [teknics](https://wordpress.org/support/users/teknics/)
 * (@teknics)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655004)
 * Well – after rerunning the script, it imported all my posts. However, it still
   didn’t categorize the posts correctly. With 109 entries this will take forever.
 * My next project, permalinks. How to get them pointing at the new posts.
 *  [teknics](https://wordpress.org/support/users/teknics/)
 * (@teknics)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655006)
 * Just another update – Will suggested I drop the database and start from scratch
   and it worked flawlessly this time.
 * I just need to figure out how to redirect all the old permalinks. He should be
   posting the new script anytime now, once he makes sure it’s 100% repaired.
 *  [luisalcaraz](https://wordpress.org/support/users/luisalcaraz/)
 * (@luisalcaraz)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655012)
 * Hi! It works nice for me.
    Thank you very much!
 *  [missmarple](https://wordpress.org/support/users/missmarple/)
 * (@missmarple)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655041)
 * As far as I can see, this script only works, if the postings are just in text
   files, not but in zipped text files (*.txt.gz). I tried unpacking manually one
   posting and the import with the script works like a charm for this posting. So
   my question is, what do I have to change in the script to let it unpack the posting
   files first?
 *  [missmarple](https://wordpress.org/support/users/missmarple/)
 * (@missmarple)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655042)
 * EDIT:
    Right, I just found out myself: Adding
 *     ```
       /^(entry[\d-]+)\.txt.gz$/ && system("gunzip -fv $dir/$_");
       ```
   
 * after line 623 in import_dir unzips the postings. I had to rerun the script afterwards
   to do the import, I’m sure there is a way to do it in one step, but I don’t know
   much Perl and that did the trick for me. Thanks for the cool script!
 *  [tmphillips](https://wordpress.org/support/users/tmphillips/)
 * (@tmphillips)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655061)
 * i am going to try this.. wish me luck.. 😉
 *  [tmphillips](https://wordpress.org/support/users/tmphillips/)
 * (@tmphillips)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655062)
 * i dont have a clue yet how to do this, but knowing that my entries are all gzipped,
   I was looking at missmarple’s post, and then comparing to the downloaded code,
   and I am guessing that the script has changed a bit because it doesn’t look right
   to add the line at 624. Instead look in that section, and add it after the import_dir
   line (?):
 *     ```
       -d "$dir/$_"             && $self->import_dir ("$dir/$_");
       /^(entry[\d-]+)\.txt.gz$/ && system("gunzip -fv $dir/$_");
       /^(entry[\d-]+)\.txt$/   && $self->add_post("$dir/$1");
       ```
   
 *  [flowolf](https://wordpress.org/support/users/flowolf/)
 * (@flowolf)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655078)
 * hello!
    thanks for this featurerich script.
 * i’m not that perl savvy so i post here for help:
 * i run into this problem:
 *     ```
       ...
       Added post 'some super title' with 0 comments
       DBD::mysql::st execute failed: Duplicate entry '6-1' for key 1 at ./WordPressImport.pl line 497.
       DBD::mysql::st execute failed: Duplicate entry '6-1' for key 1 at ./WordPressImport.pl line 497.
       ```
   
 * then i reexecute the script and it seems to work for some posts.
    it keeps telling
   me that the post i already imported are already there… every 2nd or third post
   sometimes less i get this
 *     ```
       ...
       Added post 'some title' with 0 comments
       DBD::mysql::st execute failed: Duplicate entry '15-1' for key 1 at ./WordPressImport.pl line 497.
       DBD::mysql::st execute failed: Duplicate entry '15-1' for key 1 at ./WordPressImport.pl line 497.
       ```
   
 * after
 *     ```
       for ((i=0;i<100;i++)); do ./WordPressImport.pl [...allthe flags...]; done
       ```
   
 * it gets stuck here:
 *     ```
       Post exists: 'my super title...'
       Use of uninitialized value in join or string at ./WordPressImport.pl line 484.
       Use of uninitialized value in substitution (s///) at ./WordPressImport.pl line 272.
       Use of uninitialized value in join or string at ./WordPressImport.pl line 495.
       Use of uninitialized value in join or string at ./WordPressImport.pl line 495.
       DBD::mysql::st execute failed: Column 'post_content' cannot be null at ./WordPressImport.pl line 497.
       DBD::mysql::st execute failed: Column 'post_content' cannot be null at ./WordPressImport.pl line 497.
       ```
   
 * i have no idea where to look for the failure.
 * maybe it is the use of the
 *     ```
       [html] [/html]
       ```
   
 * tags or other…
    please any help is apreciated thx flowolf
 *  [flowolf](https://wordpress.org/support/users/flowolf/)
 * (@flowolf)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655079)
 * SOLVED!
    *fuuuuh* the script does not tolerate entries that start with an empty
   line! plus i had to run it over and over again to get all the posts imported.
 * thx for the script. still helped a lot!
 *  [flowolf](https://wordpress.org/support/users/flowolf/)
 * (@flowolf)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/simplephpblog-import-utility/#post-655081)
 * it seems the first errors occur when the script has problems with tags of posts…
 * still not solved too well… there is too much handwork left. almost every posting
   has to be edited. this is too much for 300+ posts.

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/simplephpblog-import-utility/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/simplephpblog-import-utility/page/2/?output_format=md)

The topic ‘SimplePHPBlog import utility’ is closed to new replies.

## Tags

 * [Import](https://wordpress.org/support/topic-tag/import/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 7 participants
 * Last reply from: [icoholic](https://wordpress.org/support/users/icoholic/)
 * Last activity: [17 years, 9 months ago](https://wordpress.org/support/topic/simplephpblog-import-utility/page/2/#post-655109)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
