caduceus Posted October 27, 2005 Share Posted October 27, 2005 HI, Can anybody help how to connect to PostgreSQL form PHP over SSL. I know PG_Connect can be used with option requiressl, but I did not find any resource about that. Do you have some links to web pages where this is well explained? Any other way how to remotely connect to Postgres securely? Quote Link to comment https://forums.phpfreaks.com/topic/2741-postgresql-secure-connection-php/ Share on other sites More sharing options...
eawf Posted October 27, 2005 Share Posted October 27, 2005 Check out Justin Vincents "ez_sql" database wrapper class, modify it for PostgreSQL(only takes a couple lines), and then check out how it all works. It will ultimately save you LOTS of headaches, and database can be anywhere, ssl or not. HTH! Quote Link to comment https://forums.phpfreaks.com/topic/2741-postgresql-secure-connection-php/#findComment-9173 Share on other sites More sharing options...
PriceComparison Posted December 23, 2005 Share Posted December 23, 2005 First you have to turn on SSL support in the postgresql.conf configuration file. Then it depends on your library of choice to use from php. I use the standard libpq default if you compile PHP with postgresql support. The pg_connect function supports the connection to a Postgresql SSL ready server. Just look at the parameter option about the SSL: connection_string The connection_string can be empty to use all default parameters, or it can contain one or more parameter settings separated by whitespace. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\. The currently recognized parameter keywords are: host, hostaddr, port, dbname, user, password, connect_timeout, options, tty (ignored), sslmode, requiressl (deprecated in favor of sslmode), and service. Which of these arguments exist depends on your PostgreSQL version. Andrew - DBA for [a href=\"http://www.PriceComparison.com\" target=\"_blank\"]http://www.PriceComparison.com[/a] Quote Link to comment https://forums.phpfreaks.com/topic/2741-postgresql-secure-connection-php/#findComment-10321 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.