Guest User

Untitled

a guest
Jan 5th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. ## pgsql and machine info
  2.  
  3. postgresql-server-8.4.7
  4.  
  5. [root@ec2-184-73-145-17 php]# cat /etc/redhat-release
  6. CentOS release 5.5 (Final)
  7.  
  8. [root@ec2-184-73-145-17 php]# uname -a
  9. Linux cobbler 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:34:28 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
  10.  
  11. ## pg_hba.conf
  12.  
  13. # "local" is for Unix domain socket connections only
  14. local all all ident
  15. # IPv4 local connections:
  16. host all all 127.0.0.1/32 ident
  17. # IPv6 local connections:
  18. host all all ::1/128 ident
  19. host all user 10.240.217.103/8 md5
  20.  
  21. ## postgresql.conf
  22.  
  23.  
  24. listen_addresses = '*' # what IP address(es) to listen on;
  25. # comma-separated list of addresses;
  26. # defaults to 'localhost', '*' = all
  27. # (change requires restart)
  28. port = 5432 # (change requires restart)
  29. max_connections = 100 # (change requires restart)
  30.  
  31. ## attempt to connect on the command line
  32.  
  33. [root@ec2-184-73-145-17 php]# su - postgres
  34. -bash-3.2$ psql forums -l bbadmin -p secret
  35. psql: could not connect to server: No such file or directory
  36. Is the server running locally and accepting
  37. connections on Unix domain socket "/tmp/.s.PGSQL.0"?
  38.  
  39. ## attempt to connect via script
  40.  
  41. [root@ec2-184-73-145-17 php]# php connect.php
  42. PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user "bbadmin" in /home/bluethundr/php/connect.php on line 2
  43.  
  44. ## php connect script
  45.  
  46. [root@ec2-184-73-145-17 php]# cat connect.php
  47. <?php
  48. $dbconn = pg_connect("host=localhost port=5432 user=bbadmin dbname=forums password=secret");
  49. ?>
Add Comment
Please, Sign In to add comment