SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PostgreSQL on WinMe

    I am posting this here because I think that there are people in this forum (freddy and freakysid) that can help more than in the general computer probs forum.

    I am using Cygwin which is a Unix emulator for Windows. It allows you to run *nix programs and commands. I have got PostgreSQL and CygIPC. The instructions have the following commands:

    1) Start the cygipc ipc-daemon :

    ipc-daemon &

    2) Initialize PostgreSQL:

    initdb -D /usr/share/postgresql/data

    3) Start the PostgreSQL postmaster:

    postmaster -D /usr/share/postgresql/data &

    4) Connect to PostgreSQL:

    psql template1

    Ok, so I do all of this and everything seems to go fine. When I run command 4 to start PostgreSQL I get a screen saying:

    Welcome to psql, the PostgreSQL interactive terminal.

    So, everything seems to be running fine, if I press ctrl+alt+del PostgreSQL is running.

    Now the questions:

    1) How do I connect to it through PHP?

    2) It told me that the username would be default, is that the username I use when conecting ?

    3) How do I stop it running?

    4) How do I start it again in future?

    Thanks for any help

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To stop it, just kill its process. I don't really know of a better way but I'm sure the readmes have something about it.

    To start it again, run the postmaster daemon.

    To connect to it in PHP, use pg_connect - http://php.net/manual/en/function.pg-connect.php.

    To create a user, login as root and run the create user command. Then use that username to connect with PHP.

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by qslack
    To start it again, run the postmaster daemon.
    Thanks for your help Quinn. So to start it again I just need to do this:

    postmaster -D /usr/share/postgresql/data &

    psql template1

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Scrap the last question I tried it and it works fine.

    After I get it running how do I type commands? The prompt looks like this:

    template1-#

    But, it wont let me run commands from here

    Any ideas?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorted now!

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sean I am right where you are right now. So were you able to connect to the postgres server using PHP? How did you create a table to play with?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  8. #8
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I have been able to connect with PHP through http://www.greatbridge.org/project/p...rojdisplay.php

    This is phpMyAdmin but for PostgreSQL. This is what I used to create a table becasue I could not figure it out by the command line as it kept giving me errors.

    Make sure you create a user for yourself that has permission to create databases:

    CREATE USER sean WITH PASSWORD 'sean' CREATEDB;

    I have been playing with this all day (day off work ) so I might be able to answer some questions

    BTW Freddy have you worked out how to shut PostgreSQL down properly?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  9. #9
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I plan on spending sometime with it tonight. BTW did you compile your own Postgres or get a hold ofa binary. I could never get the make to go correctly. But I had a binary of 7.0 laying around.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  10. #10
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used cygwin (http://cygwin.com) the win version of PostgreSQL is only for NT

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I have cygwin as well. My question is did you actually build postgres from the source or did you copy a binary into your cygwin /usr/local/ folder?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  12. #12
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically I am in the same spot as you I can run postmaster from the cygwin command line and see dataabses, but my question is how you got to htis point I wanted to see how it differed from how I got here.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  13. #13
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, completely missed your question then!

    I grabbed the latest version of Cygwin including the PostgreSQL binary. I don't think you can compile it yourself because Cygwin lacks certain commands and that's why you have to use Cygipc as well to run PostgreSQL.

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  14. #14
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So where did you get the latest postgres binary again, I only could find 7.0
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  15. #15
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you run setup you can click on the version number next to the name to select which you want. I just looked at PG_VERSION and I have got 7.1

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •