The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP postgres connection

Discussion in 'General Discussion' started by Nico, Oct 17, 2003.

  1. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    Hello,

    Would someone please share their connection string for PHP connecting to postgresql?

    I'm using the following and it does not want to connect:

    <?
    $connection = pg_connect("host=localhost port=5432 dbname=database_name user=user_name password=password")
    or die ("unable to connect --> " . pg_last_error($conn));
    ?>


    I've played with this all day and no luck :( Postgres is running and I've compiled PHP with postgresql support.


    TIA
     
  2. hcoltrain

    hcoltrain Member

    Joined:
    Jan 8, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Sorry if this is offtopic Nico, but I need to recompile PHP with IMAP support.

    Would you share how you recompiled PHP in CPANEL?

    Thanks
     
  3. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    Here is how I recompiled it:



    cd /home/cpapachebuild/buildapache/php-4.3.3

    ./configure --with-apxs=/usr/local/apache/bin/apxs --with-xml --enable-bcmath --enable-calendar --enable-ftp --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-mcrypt --enable-magic-quotes --with-mysql --with-pear --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr -enable-gd-native-ttf --enable-versioning --with-zlib --with-xmlrpc --with-pgsql

    make

    make install

    /etc/rc.d/init.d/httpd restart
     
  4. hcoltrain

    hcoltrain Member

    Joined:
    Jan 8, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Nico,

    Thank you.

    I do not have those directories on my server.
    Where would you run this command on an Mandrake Cpanel build.

    Do I need to go get source?

    Thanks
     
  5. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    Not sure about Mandrake. You might have them in a different location. Also if you run /scripts/easyapache and recompile Apache it will create them for you. You might try running the 'locate' command to find them also.
     
  6. hcoltrain

    hcoltrain Member

    Joined:
    Jan 8, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    I feel bad about asking all these questions, but my Linux/Unix admin just decided to go so I am stuck :(

    What does the script do?

    And will recompiling Apache, which I have no idea how to do, be a big deal?
     
  7. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    /scripts/easyapache will download the required files to recompile Apache and then present you with a list of options to choose from. I usually choose option 4 and it does the rest. It's a fairly simple process.
     
  8. hcoltrain

    hcoltrain Member

    Joined:
    Jan 8, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Ok great. I now have the files and ./configured the info.
    It built the , but when I did a

    make

    I got this error

    root@web03 [/home/cpapachebuild/buildapache/php-4.3.3]# make
    make: *** No targets specified and no makefile found. Stop.

    Am I in the wrong directory?
     
  9. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    What does 'ls' show in that directory?
     
  10. hcoltrain

    hcoltrain Member

    Joined:
    Jan 8, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    / config.nice* include/ makerpm README.PARAMETER_PARSING_API scripts/
    ../ config.sub INSTALL missing README.QNX snapshot*
    acconfig.h configure* install-sh mkinstalldirs README.SELF-CONTAINED-EXTENSIONS stamp-h.in
    acconfig.h.in configure.in libs/ netware/ README.STREAMS stub.c
    Here ya go.

    acinclude.m4 CREDITS LICENSE NEWS README.SUBMITTING_PATCH tests/
    aclocal.m4 cvsclean* ltmain.sh pear/ README.TESTING TODO
    build/ ext/ main/ php4.spec.in README.UNIX-BUILD-SYSTEM TODO.BUILDv5
    buildconf* EXTENSIONS makedist* php.gif README.Zeus TODO_SEGFAULTS
    CODING_STANDARDS footer makedist.ZendEngine2* php.ini-dist regex/ TSRM/
    confdefs.h .gdbinit Makefile.frag php.ini-recommended run-tests2.php win32/
    config.cache generated_lists Makefile.fragments README.CVS-RULES run-tests.php* Zend/
    config.guess genfiles* Makefile.global README.EXTENSIONS sapi/
    config.log header Makefile.objects README.EXT_SKEL scan_makefile_in.awk
     
  11. hcoltrain

    hcoltrain Member

    Joined:
    Jan 8, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    I checked the config.log and when it got to checking of IMAP was working I got this.

    /usr/src/RPM/BUILD/imap-2001a/c-client/auth_gss.c:64: undefined reference to `gss_nt_service_name'
    /usr/src/RPM/BUILD/imap-2001a/c-client/auth_gss.c:64: undefined reference to `gss_import_name'
    /usr/src/RPM/BUILD/imap-2001a/c-client/auth_gss.c:67: undefined reference to `krb5_init_context'
    /usr/src/RPM/BUILD/imap-2001a/c-client/auth_gss.c:69: undefined reference to `krb5_kt_default'
    /usr/src/RPM/BUILD/imap-2001a/c-client/auth_gss.c:75: undefined reference to `krb5_free_context'
    /usr/src/RPM/BUILD/imap-2001a/c-client/auth_gss.c:77: undefined reference to `gss_release_name'


    I got a bunch of these. Am I missing and RPM?
     
  12. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    Nico, were you ever able to connect? I cannot connect either. I thought everything was working okay, but it is not, apparently.
     
  13. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    It worked shortly with the cpanel username and password, but it crashes often.
     
  14. X-Istencedotcom

    X-Istencedotcom Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    223
    Likes Received:
    0
    Trophy Points:
    16
    cPanel support for it is not to great. Its a shame really, as PostgreSQL can do a lot more, and is best for bigger sites.
     
  15. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    I reinstalled postgre, but I think that it was a problem with php. After I recompiled apache I was able to connect. I don't know if it's going to crash again or not, but it seems okay right now.

    I'm on RH9 and php 4.3.3
     
  16. dewaard

    dewaard Member

    Joined:
    Mar 19, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Take a look at the manual. http://www.php.net/pg_connect
     
Loading...

Share This Page