If curl is loaded before postgres in php, there is some errors in the shutdown due to shared libraries being unloaded in the wrong order.
A quick and easy fix:
cd /etc/php5/conf.d
cp pdo_pgsql.ini 0pdo_pgsql.ini
cp pgsql.ini 0pgsql.ini
chmod 600 pgsql.ini pdo_pgsql.ini
🙂