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

update: 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 https://serverfault.com/questions/359078/enable-php-zts-and-mpm-workers-in-apache-to-lower-memory-footprint-but-still-ke

  • Which version of linux? – Shadur Jul 18 '15 at 9:23
  • @Shadur updated my answer with Linux information – dev.e.loper Jul 18 '15 at 17:00
  • Looks like Fedora, but I'm not that sure...might as well be RHEL – syntaxerror Jul 18 '15 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. – Shadur Jul 18 '15 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 – dev.e.loper Jul 21 '15 at 15:29
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

  • I checked the /etc/php.ini config and it has a line extension=php_mysql.so uncommented – dev.e.loper Jul 17 '15 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 Jul 17 '15 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! – syntaxerror Jul 18 '15 at 19:42

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.