Thanks, this post helped me a lot. Wanted to add that if you want to print the list of recent posts outside WP folder but inside a folder parallel to WP, the initial PHP does need the docroot:
<?php
require_once(“/home/userid/public_html/otherfolder/wp-blog-header.php”);
define(‘WP_USE_THEMES’, false);
?>
<?php wp_get_archives(‘type=postbypost&limit=5’); ?>