Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Issue was an incorrect parameter during compilation. See my answer for details.


The result of the following command probably sheds some light on the issue!

# php-cgi -m
[PHP Modules]

There is no pdo_mysql extension here... why?? The php.ini is the same as what is used for PHP in CLI which loads the pdo_mysql extension (via extension_dir)

Original Question:

Compiled PHP 5.5.1 on Ubuntu 12.04

# php -v
PHP 5.5.1 (cli) (built: Aug 22 2013 02:57:03)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies

PDO MySQL extension loads on CLI:

# php --ri pdo_mysql


PDO Driver for MySQL => enabled
Client API version => mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 $

Directive => Local Value => Master Value
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

When I access a page using CGI/FastCGI, the PDO MySQL extension does not load

<?php phpinfo(); ?>
PDO support     enabled
PDO drivers     sqlite

In both cases, the same extension_dir and php.ini file are being used.

php.ini path: /usr/local/lib/php.ini
extension_dir: /usr/local/lib/php/extensions/no-debug-non-zts-20121212

Contents of extension_dir:

#ls /usr/local/lib/php/extensions/no-debug-non-zts-20121212  opcache.a

How can I get PHP running in FastCGI to recognise and load the PDO MySQL extension?

share|improve this question
I have posted my answer, will "accept" it when some waiting period is finished – tanerkuc Aug 22 '13 at 8:36

Man that was a frustrating experience...

Turns out a set of directions I was following used a configure parameter for enabling CGI for an older PHP version (this parameter has changed between 3 variations over PHP's lifetime), and is still not 100% clear if you look at the manual:

I had to recompile with the --enable-cgi option, not --with-fastcgi (< 4.3), nor --enable-fastcgi (< 5.3), nor --disable-cgi (> 5.3 and the docs mention this enables fastcgi but seems to be something different to my case)

On the plus side, I had an excuse to upgrade to 5.5.2 :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.