2

Update 2 (ISSUE RESOLVED):

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

Update:

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

# php-cgi -m
[PHP Modules]
...
PDO
pdo_sqlite
...

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_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
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
mcrypt.so  opcache.a  opcache.so  pdo.so  pdo_mysql.so

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

1
  • I have posted my answer, will "accept" it when some waiting period is finished
    – tanerkay
    Aug 22, 2013 at 8:36

1 Answer 1

0

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: http://php.net/manual/en/configure.about.php

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 :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .