Replacing MySQL with PostgreSQL in php-fpm

On autopilot, I generated a web server stack with nginx, PHP and MySQL. The company uses Postgres everywhere though, so I took that as a long, overdue excuse to use it myself.

# apt-get remove mysql-server mysql-client  
# apt-get install postgresql postgresql-client php5-pgsql

Then the requisite PHP packages:

# apt-get install php5-pgsql  
# apt-get remove 

The classic <?php phpinfo() ?> will still show MySQL capabilities though, so we need to remove the MySQL conf files from php-fpm:

$ ls /etc/php5/mods-available  
==> apc.ini  intl.ini  mysqli.ini  mysql.ini  pdo.ini  
==> pdo_pgsql.ini  pgsql.ini  
# rm mysql*ini


This is one of about 5000 posts on Rubénerd. View the home page for the latest, or related posts also tagged with:

If you liked this post, feel free to buy me a coffee, leave me a comment on Twitter, or email me at Thanks :).