Centos – Drupal7 doesn’t detect MySQL on CentOS, but WordPress3 does

centosdrupalMySQLPHPWordpress

I'm running CentOS 5.5 here with Apache2, PHP5.3.3, and MySQL 5 (Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i686) using readline 5.1). My wordpress install on the same system runs perfectly, but the drupal7 install script only detects SQLite. The mysql module is enabled in php.ini, so that isn't the problem. Do you think it could be something with Drupal 7, or my PHP install? I tested it on localhost (I'm essentially running ArchLinux with Apache) and it installs just fine. I don't see a difference between my local php.ini and my server php.ini. I get this when accessing install.php on the server.

SQLite
The type of database your Drupal data will be stored in. Your PHP configuration only supports a single database type, so it has been automatically selected.

Edit: The mysql PDO module is installed already.

Final edit: The issue was that PHP wasn't actually loading the modules. It was looking at the file in /usr/local/lib/php.ini rather than /etc/php.ini. After implementing the suggestions here, I changed the php.ini file configuration, restarted apache, and it works fine. Thanks to all who replied.

Best Answer

See EDIT at the end FIRST!

The MySQL module has been enabled - but has it been installed:

su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm'
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm
yum --enablerepo=remi install php-pdo

Also - to make sure all needed modules are installed:

yum --enablerepo=remi install php-mysql

This may also update other php dependencies.

EDIT:

I just had cause to do this on a 64-bit Centos server and got some dependency error messages and then mysql would not start due to this error:

Error message file '/usr/share/mysql/english/errmsg.sys' had only 480 error messages,
but it should contain at least 641 error messages.

With a bit of digging this turned out to be because I ended up with both the 64-bit AND 32-bit versions of mysql installed. I finally got round this by doing the following:

yum remove mysql-server*
yum remove mysql-*
yum install --enablerepo=remi mysql.x86_64 mysql-server.x86_64 php-mysql php-pdo

You may not run into this extra work if you yum remove mysql and mysql-server first.

Because of the extra hassle, I have to add: 'Follow my steps at your own risk'!!!