note 28098 rejected from ref.pgsql by nicos

From: Date: Thu, 02 Jan 2003 11:30:21 +0000
Subject: note 28098 rejected from ref.pgsql by nicos
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41578@lists.php.net to get a copy of this message
I had a need to see if PHP would connect to an SSL-enabled PostgreSQL server using SSL as required by a hostssl entry in the pg_hba.conf file of the server. Since I hadn't seen this addressed anywhere, I decided to do some testing on my own. Using a box running Debian Linux 3.0r0 (Woody), which provided PostgreSQL 7.2.1 (package postgresql_7.2.1-2woody2_i386.deb), I wrote a PHP script on another Woody box using PHP 4.1.2 (package php4-cgi_4:4.1.2-5_i386.deb with php4-pgsql_3:4.1.2-4_i386.deb) to perform the simple query "SELECT * FROM pg_database" and enumerate out each row as an associative array echoed to the console using print_r. PostgreSQL Logging at the highest debug level failed to reveal whether a connection was over SSL or not, so I ran tcpdump on the server as follows (tcpdump -X tcp dst port 5432) both with SSL turned on and off in postgresql.conf, and where I could read plain-text in the non-SSL sessions, the SSL sessions yielded no discernable human-readable text whatsoever (Sorry, I'm not at liberty to actually post the contents of the packet dumps themselves; you'll just have to take my word for it). Also, the Debian package for openssl did not appear to have been necessary on the client (didn't check the server, as it was also installed there, but I doubt that it's necessary). I'm sure that libssl0.9.6 was probably a prerequisite (Debian package libpgsql2 depends upon it, so...), but uninstalling that would have robbed me of my ability to communicate with either the client or the server, so I couldn't check that. So, in short, PHP appears to support connecting to SSL-capable PostgreSQL servers using SSL as long as libssl is installed, because that capability is actually provided by libpgsql2, and not the PostgreSQL module for PHP. Of course, as the saying goes, your mileage may vary. :)

« previous php.notes (#41578) next »