If you're behind a gateway, reverse proxy or some kind of load-balancer you'll have problems using the sitemap generator as your domain name will loop back on itself. You don't want to use the local machine name as it'll mess up the generation of the sitemap.
You'll need to add an entry to your hosts file for your domain name - pointing to 127.0.0.1.
ie
hosts
[ External links are visible to forum administrators only ] 127.0.0.1
You can then run the sitemap generator from the prompt without problems.
Keep in mind if you run the script from the prompt - you'll may be using a different php.ini from that being by the website (often the case on linux).