I just try to install the PostGIS 2.0.3 on PostgreSQL x64 9.1 on the Windows Server 2008 R2. I got the error message "Error openning file for writing" C:\Program Files\PostgreSQL\9.1\bin\libiconv-2.dll. Should I click "Abort", "Retry" or "Ignore"? Thanks. :)


Set your install and data directories to a path outside of c:/Program Files. My install folders are c:/PostgreSQL

| improve this answer | |
  • Thanks. It works! The postgis is completely installed, but I skip the error message "Error openning file for writing" C:\Program Files\PostgreSQL\9.1\bin\libiconv-2.dll! Can I do this? – wing suet cheung Jan 9 '14 at 4:30
  • I do not totally understand the comment. Are you still getting the error message C:\Program Files\PostgreSQL\9.1\bin\libiconv-2.dll when using a installation and data directory like c:\PostgreSQL\... ? – Ralph Dell Jan 9 '14 at 13:28
  • The PostGIS is installed. Yes, the message "Error openning file for writing" C:\Program Files\PostgreSQL\9.1\bin\libiconv-2.dll" is still there, I just click the "ingore" button. – wing suet cheung Jan 10 '14 at 8:41
  • If you specify your install folder as c:/PostgreSQL/.. then you should not have any components installed in c:/Program Files. I am looking at my windows 2008 R2 server and there is not a PostgreSQL folder under Program Files. I am guessing that it is an artifact from your first attempts. I would uninstall post, delete that folder under Program Files, and reinstall Post and set the install and data directories to be under c:/PostgreSQL – Ralph Dell Jan 10 '14 at 13:23

You cannot overwrite libiconv-2.dll because it has been locked by postgres.exe. So, first you must stop the postgresql-9.1 service from your control panel/administrative tools/services. Second, restart the PostgreSQL service, rename libiconv-2.dll to libiconv-2.old and then proceed the PostGIS installation.

| improve this answer | |
  • Forgot about this too, it's probably it. – SaultDon Jan 8 '14 at 14:20

I had this problem due to user permission errors on Windows Server 2008 R2.

It might not like that your Domain user is also an admin user. It might expect a local admin user instead.

I remember creating a local (not a DOMAIN user) user with admin rights or used an existing account with admin rights then logged in with that local admin user and installed that way.

Then logged out and back in with regular user/domain account.

| improve this answer | |
  • I used local admin user to install! It doesn't work! – wing suet cheung Jan 8 '14 at 3:32
  • @wingsuetcheung did you launch the installer as an administrator from the right-click menu after logging in as a local admin user? – SaultDon Jan 8 '14 at 4:08
  • Yes I did tried. :( – wing suet cheung Jan 8 '14 at 4:13
  • @wingsuetcheung Sorry, I can't think of anything else. It would be really helpful if you could do some troubleshooting from your end and maybe update your question with what you did and found. – SaultDon Jan 8 '14 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.