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.

postgressql issue

Discussion in 'General Discussion' started by chadi, Aug 24, 2004.

  1. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Client is having trouble with PostgresSQL (already installed on the server). He says this:

    The problem is: we are currently not being able to access it from inside our PHP application.

    "phpinfo()" function shows us that PHP was configured without the support to PostgreSQL (only MySQL), as can be seen below:

    './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml'
    '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-swf=/usr/local/flash'
    '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr'
    '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-imap' '--with-imap-ssl'
    '--with-kerberos' '--with-java=/usr/local/jdk' '--enable-mbstring'
    '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mcrypt' '--with-mhash'
    '--enable-magic-quotes' '--with-mysql' '--with-openssl' '--enable-discard-path'
    '--with-pear' '--enable-sockets' '--enable-track-vars' '--with-ttf'
    '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--enable-versioning'
    '--with-xmlrpc' '--with-zip' '--with-zlib'

    We need to access the database remotely so that we can see all the tables and fields from inside our local development environment. This remote access is being configured through the setup of a local Data Source Name, using PostgreSQL ODBC driver, but the following error message is being issued:

    Data Link Error

    Test Connection failed because of provider initialization error.

    Could not connect to the server;

    Could not connect to remote socket.

    -------
    It shows in WHM (under service configuration). Why does it not work now?
     
  2. 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
    If they want to access it remotely you will need to open up the port in postgresql.conf. You will need to uncomment the line about tcp/ip connections and set it to true. This is disabled by default for security.
     
  3. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Is this high risk to allow the open port for remote access?
     
  4. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Can someone please explain to me if this is a serious risk issue to allow remote access?
     
  5. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Also, client already created a PostgresSQL database yet it is not listed via cPane but he can access the db via phpPgAdmin.
     
  6. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Here is the request:

    Being able to login wih SSH, I could see that I don't have access to PostgreSQL configuration files. The thing is that we need remote access to the database. We need to access the database remotely so that we can see all the tables and fields from inside our local development environment. This remote access is being configured through the setup of a local Data Source Name, using PostgreSQL ODBC driver, but the following error message is being issued:

    Data Link Error
    Test Connection failed because of provider initialization error.
    Could not connect to the server;
    Could not connect to remote socket.

    I know we should configure PostgreSQL configuration files for remote access (pg_hba.conf), but logging in with SSH I could see that I don't seem to have access to this file. Could you setup this permission for us? (since for the time I have a fixed IP address, you could even restrict DB access to my IP address only!).

    I can see PHP is now configured for accessing both MySQL as well as PostgreSQL (at first it was configured only for MySQL). But now I receive the following error message issued from the PHP page which tries to access the database:

    Warning: pg_pconnect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host localhost and accepting TCP/IP connections on port 5432? in /home/fwintern/public_html/db_pgsql.php on line 72
    Database error: Link-ID == false, pconnect failed
    PostgreSQL Error: 0 ()
    Session halted.

    Normally this would indicate that the Postmaster is not running, or most probably that PostgreSQL was started without accepting TCP/IP connections.

    What exactly should I do? I am a littel concerned about enabling remote access here but is there a way around this without full remote access?
     
  7. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Somone please help me. I'd appreciate it.
     
  8. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    Someone please help
     
  9. vivek

    vivek Well-Known Member

    Joined:
    Mar 2, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
  10. chadi

    chadi BANNED

    Joined:
    Apr 20, 2004
    Messages:
    415
    Likes Received:
    0
    Trophy Points:
    0
    You told me to check the forums first. What made you think I did not? That link you provided is far from what THIS thread is about. You should read the thread first. My questions were relating to "remote access" not issues using PostgreSQL itself. It works fine but I wanted to know what the issues/security is all about with enabling remote access and such.

    Thanks anyway.
     
  11. Spaceh

    Spaceh Active Member

    Joined:
    Apr 11, 2004
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    Solution i think....

    it has been posted here before but i think this one its more clear.


    In postgres.conf modify the following:

    - tcpip_socket = true <-- this is commented out and set to false by default
    - port = 5432 <-- default, but is commented out
    - max_connections = 32 <-- it is commented out, set it to the max number of
    connections you feel you DBMS will require


    Now edit pg_hba.conf:

    - to use the system locally (which is most common), uncomment the lines
    that refer to localhost. These files are located at the bottom of the file.

    local all trust
    host all 127.0.0.1 255.255.255.255 trust
    local all ident sameuser

    Thanks Casey, you helped, realy. :cool:
     
  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
    No problem. Some people have to be spoon-fed. I gave chadi all the information that he needed in order to figure it out for himself, but he was too lazy.
     
Loading...

Share This Page