Guest User

Untitled

a guest
Jan 5th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. ## pg_hba.conf
  2.  
  3. # "local" is for Unix domain socket connections only
  4. local all all ident
  5. # IPv4 local connections:
  6. host all all 127.0.0.1/32 ident
  7. # IPv6 local connections:
  8. host all all ::1/128 ident
  9. host all user 10.240.217.103/8 md5
  10.  
  11. ## postgresql.conf
  12.  
  13.  
  14. listen_addresses = '*' # what IP address(es) to listen on;
  15. # comma-separated list of addresses;
  16. # defaults to 'localhost', '*' = all
  17. # (change requires restart)
  18. port = 5432 # (change requires restart)
  19. max_connections = 100 # (change requires restart)
  20.  
  21. ## attempt to connect on the command line
  22.  
  23. [root@ec2-184-73-145-17 php]# su - postgres
  24. -bash-3.2$ psql forums -l bbadmin -p secret
  25. psql: could not connect to server: No such file or directory
  26. Is the server running locally and accepting
  27. connections on Unix domain socket "/tmp/.s.PGSQL.0"?
  28.  
  29. ## attempt to connect via script
  30.  
  31. [root@ec2-184-73-145-17 php]# php connect.php
  32. 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
  33.  
  34. ## php connect script
  35.  
  36. [root@ec2-184-73-145-17 php]# cat connect.php
  37. <?php
  38. $dbconn = pg_connect("host=localhost port=5432 user=bbadmin dbname=forums password=secret");
  39. ?>
Add Comment
Please, Sign In to add comment