Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Malibu, CA

    php and postgresql

    I think I have installed postgresql and its pho module

    I created usernames using su - postgresql well.
    However, I could not connect using pg_connect.
    The error message is as follows:


    if($con == false){
    echo "接続できません・・・";
    echo "接続できました!";

    Warning: pg_connect() unable to connect to PostgreSQL server: FATAL 1: user "nobody" does not exist in /home/clinical/public_html/postgre.php on line 7

    Do you have any idea what had happend?

    Thank you very much. Joe.

  2. #2
    Join Date
    Nov 2001
    PostgreSQL connection functions typically need some info from your script in order to run properly. You are using what appears to be the "old" PHP syntax.

    The new syntax looks like the following, note not all parameters are required

    $conn = pg_connect("host=myHost port=myPort tty=myTTY options=myOptions dbname=myDB user=myUser password=myPassword ");
    // Change your script to include at least:
    host=yourhostname  // could be local host
    dbname=yourdatabase name
    i.e. try at least:
    $conn = pg_connect("host=myHost dbname=myDB");
    and if that doesn't work, be sure you have CREATE USER someuser and GRANT user to ....
    and see what happens.

    You should also configure specific users and passwords to have access to specific databases. You don't want to give "nobody" access to every table / database in the joint.

    PostgreSQL docs on user management are straightforward - refer to them now.

    This is pretty basic stuff -- chances are very high you will end up leaving security holes in your wake as you pass through this. Be careful, or better yet, get some experienced help to get you going on the right path.
    Last edited by mwatkins; 10-28-2002 at 05:27 PM.
    “Even those who arrange and design shrubberies are under
    considerable economic stress at this period in history.”

Posting Permissions

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