2

I have a CentOs 6.7 server. I have problem to make pdo_mysql available on apache2. following shows for Command line:

myserver$ php -m
PDO, pdo_mysql, pdo_sqlite

but phpinfo(), shows only PDO and pdo_sqlite

I already included following in php.ini

extension=pdo_mysql.so
extension=pdo.so

And restarted the Apache with:

sudo service httpd restart

It looks like, pdo_mysql is installed on a different php. when I search the server for pdo.so and pdo_mysql.so, I get pdo.so in three places, but pdo_mysql in two places.

myserver$ locate pdo.so
/usr/lib64/php/modules/pdo.so
/usr/lib64/php-zts/modules/pdo.so
/var/opt/remi/php56/root/usr/lib64/php/modules/pdo.so

myserver$ locate pdo_mysql.so
/usr/lib64/php/modules/pdo_mysql.so
/usr/lib64/php-zts/modules/pdo_mysql.so

And Apache installation in phpinfo() shows:

Loaded Configuration File   /opt/remi/php56/root/etc/php.ini 

So my recent php upgrade to php 5.6 is missing pdo_mysql. other php installation has it, but I don't know how to force the pdo_mysql installation to install it to /var/opt/remi/php56/

I used following for installing pdo-mysql:

yum install pdo-mysql

So, it installed it under /usr/lib64/php/ but not under /var/opt/remi/php56/.

3

It seems you are confused by the 2 available PHP stacks in remi repository.

  • php-* packages = base packages with configuration in /etc
  • php56-php-* packages = software collections for parallel installation with configuration in /opt

Also see the FAQ

And Apache installation in phpinfo() shows: Loaded Configuration File /opt/remi/php56/root/etc/php.ini

This means you are using the SCL version. So you need php56-php-mysqlnd

I already included following in php.ini

You never have to change the php.ini, each package provides its configuration file which enable the extension (and ensure correct load order, e.g. pdo "before" pdo_mysql)

I recommend you follow the Configuration Wizard results

1

You have installed PHP through the Remi repository.

Try this:

yum --enablerepo=remi,remi-php56 install php-pdo_mysql

That should keep your PHP installation nicely in sync.

  • Thanks JayMcTee. But it did not work! this is what I got in response: Loaded plugins: fastestmirror, priorities, rhnplugin, security This system is receiving updates from RHN Classic or Red Hat Satellite. Setting up Install Process Loading mirror speeds from cached hostfile * remi: mirrors.mediatemple.net * remi-php56: mirrors.mediatemple.net * remi-safe: mirrors.mediatemple.net remi | 2.9 kB 00:00 remi/primary_db | 1.4 MB 00:00 No package pdo-mysql available. Error: Nothing to do – Navid Langaroudi Mar 15 '16 at 19:29
  • "pdo-mysql" is not correct, for "foo" extension use php-foo, (so php-pdo_mysql which is provided by php-mysqlnd package or php56-php-pdo_mysql provided by php56-php-mysqlnd). See my answer below. – Remi Collet Mar 16 '16 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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