2

I am running PHP 5.6 on Linux. When I try to load a PHP page, I'm getting the following PHP error.

PHP Startup: Unable to load dynamic library /usr/lib64/php/modules/php_mysql.so'

When I look in the directory /usr/lib64/php/modules/ indeed there is no shared object php_mysql.so. So, it looks like php extension for mysql isn't installed. So I run the yum install:

yum install php56w-mysql

and I get the message that:

Package php56w-mysql-5.6.10-1.w6.x86_64 already installed and latest version

So, is my php.ini configuration incorrect? Should I point it in a different place to look for php-mysql extension?

Linix version information: Linux version 3.14.35-28.38.amzn1.x86_64 (mockbuild@gobi-build-64012) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) )

Ran suggested command to view where modules are installed:

rpm -ql php56w-mysql

/etc/php-zts.d/mysql.ini
/etc/php-zts.d/mysqli.ini
/etc/php-zts.d/pdo_mysql.ini
/etc/php.d/mysql.ini
/etc/php.d/mysqli.ini
/etc/php.d/pdo_mysql.ini
/usr/lib64/php-zts/modules/mysql.so
/usr/lib64/php-zts/modules/mysqli.so
/usr/lib64/php-zts/modules/pdo_mysql.so
/usr/lib64/php/modules/mysql.so
/usr/lib64/php/modules/mysqli.so
/usr/lib64/php/modules/pdo_mysql.so

Looks like I installed a php-zts and there is a similar issue here: Enable PHP-ZTS and MPM Workers in Apache to lower memory footprint, but still keep MySQL?

5
  • Which version of linux? Commented Jul 18, 2015 at 9:23
  • @Shadur updated my answer with Linux information Commented Jul 18, 2015 at 17:00
  • Looks like Fedora, but I'm not that sure...might as well be RHEL Commented Jul 18, 2015 at 19:38
  • 2
    Try rpm -ql php56w-mysql, that should (it's been a while since I used RPM) give you a list of where the package's files are stored. There may be a mismatch between where it stored them and where php thinks they're supposed to be. Commented Jul 18, 2015 at 20:17
  • @Shadur it looks like the shared objects are in php-zts folder. I tried updating the extension_dir location and got a different error. Module compiled with build ID=API20131226,TS PHP compiled with build ID=API20131226,NTS Commented Jul 21, 2015 at 15:29

1 Answer 1

1

Find the following line in your php.ini:

;extension=php_mysql.so

Remove the semicolon, which is serving as a comment, then restart apache.

If that doesn't work, report back...

This has been transcribed from StackOverFlow

3
  • I checked the /etc/php.ini config and it has a line extension=php_mysql.so uncommented Commented Jul 17, 2015 at 22:36
  • Assuming something else is missing, please attempt How to Install a LAMP stack on CentOS, Fedora, or Red Hat using the "Individual Commands" Section. If that works, I'll add the commands here.
    – eyoung100
    Commented Jul 17, 2015 at 22:43
  • 1
    What about extension=mysql.so in php.ini? Just checked a closely related RPM package (CentOS 7) and in that case, the module was actually found under /usr/lib64/php/modules/mysql.so! If that works, the packager should get a decent slap, because of breaking common file naming due to doing things his own way! Commented Jul 18, 2015 at 19:42

You must log in to answer this question.

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