Apache is probably using a php5-cgi. This installs a mod_php5.so in the Apache modules directory and is normal.
php5-cli gives you access to PHP from the command line. It installs a compiled PHP executable and places it in /usr/bin (or another location along your path).
Everything is normal as far as I can tell with your installation.
Is this a managed or dedicated server / VPS with cPanel, WHM, or plesk installed on it? Those management software packages typically "break" the normal system behavior and configuration as far as Apache, PHP, databases, and modules and extensions go.
I don't know the apt-get command to remove packages, so you'll have to look it up. But you might try removing php5-pgsql, then adding it back, and restarting Apache and seeing if pgsql shows up in the phpinfo() web page.
In the phpinfo() web page, take not of the following settings which will be near the top:
loaded configuration file: this gives you the path to the php.ini file to edit to effect changes in php running under apache
additional ini files (or similar name): this should list each file in the php5.d or php5.conf directory, so you'd have a list like: pdo.ini, mysql.ini, mcrypt.ini, etc
extension directory (or similar name): this will tell you where the *.so files are for php extensions, check this directory for a pgsql.so or similar
Then from the command line run:
php -i | less and take not of the same settings. If you could copy and paste the values here that may be helpful in assisting you.
I see something called PDO, with enabled = no value
It might but I'm not expecting it to. Each database extension you install in PHP will enable a group of functions prefixed with the database they're used with. For example, enabling the MySQL extension will add functions mysql_connect(), mysql_query(), mysql_fetch(), and other functions beginning with mysql_. Adding Postgres extension will enable functions pgsql_connect(), pgsql_query(), etc (or maybe they're just psql_).
PDO is a more abstract database layer where you just tell it what database to connect to (host, user, password, database_name) and what database it is (mysql, pgsql, sqlite). Then you use the
same function calls regardless of the database type. In addition PDO has more simple mechanisms of adding parameters to queries and escapes them properly. The code example I gave you earlier instantiates a PDO object for a pgsql database.
If you are starting from scratch in your endeavors, then I
highly recommend you learn how to use PDO to interact with Postgres. It will make your life much easier.
As far as your inquiry I'll reiterate. PDO is a more abstract database layer than "plain ol' pgsql." PDO is dependent on pgsql being installed to function correctly with pgsql, not vice versa. Again, I could be mistaken.
On the latest Ubuntu box that I configured, PDO was already installed and enabled when I installed php5. You
may need to
apt-get php5-pdo (or the equivalent).
Once php5-cgi and php5-cli and PDO were all installed, when I ran
apt-get php5-pgsql it correctly installed and enabled the pgsql_ functions (i.e. the "regular" stuff)
and it enabled pgsql for PDO as well.
Finally, just to remind you, I'd like to see those config settings I mentioned earlier. I also need to know if you have WHM, cPanel, or plesk installed.