PHP Startup: Unable to load dynamic library 'mysql.so'

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 23.0.5
Operating system and version (eg, Ubuntu 20.04): Synology DSM 6.2
Apache or nginx version (eg, Apache 2.4.25): Apache 2.2.34
PHP version (eg, 7.4): 7.4.9

The issue you are facing:

I am seeing the following log message (thousands of them) in my nextcloud log. As the message states, the mysql.so file is not found. However, the mysql package for PHP is deprecated (since 7.2 or earlier) and is not available for my system. The question is: what exactly requires this package/module to be loaded?

I know there are older posts here about similar things. But they all are pretty old. I wonder if this error should be there with newest PHP 7.4.

The output of your Nextcloud log in Admin > Logging:

PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0

config.php:

<?php
$CONFIG = array (
  'instanceid' => 'ocqkr2xqosoa',
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' =>
  array (
    0 => '192.168.2.11:7777',
    1 => 'XXX',
    2 => 'XXX',
  ),
  'datadirectory' => '/volume1/nextcloud',
  'dbtype' => 'mysql',
  'version' => '23.0.5.1',
  'overwrite.cli.url' => 'XXX',
  'dbname' => 'Nextcloud',
  'dbhost' => '127.0.0.1:3307',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_ncadmin',
  'dbpassword' => 'XXX',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'DE',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
);

nextcloud.log:

{"reqId":"QA00IVif6TRf4J4HUS6f","level":3,"time":"2022-10-19T06:00:27+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}
{"reqId":"PCOPECjUaBXSIIjRyODm","level":3,"time":"2022-10-19T07:00:12+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}
{"reqId":"jhYByM3EIwJ4olO5aJBK","level":3,"time":"2022-10-19T08:00:13+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}
{"reqId":"xHm7QY9xGbLQDEg0e1am","level":3,"time":"2022-10-19T09:00:12+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}
{"reqId":"sEN9tbvLaTmRcE6ErqLY","level":3,"time":"2022-10-19T10:00:13+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}
{"reqId":"cwk2pwBQ1CEk318HcUgB","level":3,"time":"2022-10-19T11:00:06+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}
{"reqId":"MeokrvyXRLCn0lglZbig","level":3,"time":"2022-10-19T12:00:19+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"PHP Startup: Unable to load dynamic library 'mysql.so' (tried: /usr/local/lib/php74/modules/mysql.so (/usr/local/lib/php74/modules/mysql.so: cannot open shared object file: No such file or directory), /usr/local/lib/php74/modules/mysql.so.so (/usr/local/lib/php74/modules/mysql.so.so: cannot open shared object file: No such file or directory)) at Unknown#0","userAgent":"--","version":"23.0.5.1"}

Errors are errors and in most cases not related to a specific PHP version. If you’ve configured Nextcloud to use a MySQL or MariaDB database a MySQL PHP module (pdo_mysql.so) is required to access the database. In the administrator guide you will find information about how to set-up the correct database access:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html#database-configuration

That’s not what the error message says. I know that this PHP module is required for accessing the database, which is why I already installed it and activated the pdo_mysql.so in the PHP settings. It is functional and obviously not the problem.

The error message is complaining about mysql.so which is another MySQL PHP module and deprecated as of now. Again the question is: what part of Nextcloud is using this module and why (if PDO is working)?

Unknown#0

Why is the error message so unspecific about the origin? Could it indicate to be any of the installed apps?

Nextcloud is only using a PHP function to access the database. Due to the fact that the error message is coming from PHP itself, how should Nextcloud know any details about the underlying root cause?

Check your PHP configuration and try to find out, if the given PHP module is configured to be loaded or if the mysql.so library has a mysql.so requirement, by e.g. using the ldd command.