Short update to the problem below:
I created a small script
<?php
if (!extension_loaded('mysqli')) {
dl('mysqli.so');
}
?>
To test my problem further. The strange thing is: when I execute this as root, it works properly, means the mysqli-extension is available. When I execute this as any other user, it returns
Warning: dl(): Unable to load dynamic library 'mysqli.so' (tried: /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats), /usr/lib/php/20170718/mysqli.so.so (/usr/lib/php/20170718/mysqli.so.so: cannot open shared object file: No such file or directory))
The related user is already member of the group MySQL - so what else could cause this behaviour?
When calling a PHP script which makes use of mysqli-functions, it fails at the very beginning with the above error message. The scripts itself all come from a different system with same PHP-version where they worked properly. The weird thing is: this happens only when calling a script from CLI, when running the same from Apache2, everything is fine. What I have done:
- Symlink from /etc/php/7.2/cli to /etc/php/7.2/apache2 so that both are guaranteed to use the same configuration
- MySQL-package installed (elsewhere it would not work in Apache)
- MySQL-package enabled (elsewhere it would not work in Apache)
Any ideas what still could be wrong here?