Replacing MySQL with PostgreSQL in php-fpm

Software

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

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.