Ubuntu 12.04 php5-fpm stopped recognizing MySQL

Rob Wilkerson asked:

So this morning I used aptitude to install a few security updates. Seemed innocent enough until stuff stopped working. Somewhere along the way, a few packages got dropped, I guess. Now PHP (specifically PHP5-FPM) doesn’t think it’s connected to MySQL and I have no idea why. All packages seem to be installed. According to phpinfo():

  • The php.ini file from /etc/php5/fpm.
  • An additional /etc/php5/fpm/conf.d/mysql.ini file is being parsed (among others)
  • The mysql.ini file includes this line:


Installed PHP-related packages:

$ dpkg --get-selections | grep php  
libapache2-mod-php5       install
php-pear          install
php5            install
php5-cgi          install
php5-cli          install
php5-common         install
php5-curl         install
php5-dev          install
php5-fpm          install
php5-gd           install
php5-mcrypt         install
php5-memcache         install
php5-mysql          install

Installed MySQL packages:

$dpkg --get-selections | grep mysql
libdbd-mysql-perl       install
libmysqlclient-dev        install
libmysqlclient18        install
mysql-client-5.5        install
mysql-client-core-5.5       install
mysql-common          install
mysql-server          install
mysql-server-5.5        install
mysql-server-core-5.5       install
php5-mysql          install

Services status:

$ sudo service --status-all
 [ + ]  memcached
 [ ? ]  mysql
 [ ? ]  network-interface
 [ ? ]  network-interface-container
 [ ? ]  network-interface-security
 [ ? ]  networking
 [ + ]  nginx
 [ + ]  php5-fpm
 [ + ]  ssh

As you might expect from the services output, this is a nginx+php5-fpm+mysql install. Although status-all shows unknown, the mysql service is running (confirmed w/ ps).

Granted, I’m no sysadmin (!), but I’ve exhausted everything I can find or think of that would prevent the MySQL extension from being loaded. If anyone can offer any guidance I’d very much appreciate it. No doubt I’m missing something fundamental, but I’m at a loss right now for what it might be.



For whatever it might be worth, when looking at the phpinfo output, I also don’t see groups for curl or gd, but do see groups for mcrypt and memcache. I’m not sure what to make of that. If I try to install php5-mysql, apt just tells me it’s already installed.

My answer:

Have you tried restarting php5-fpm? apt should restart it during the upgrade, but sometimes it gets the timing wrong.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.