I run the following statements (so it is completely reproducible) (because i wanted to play with the source code of WordPress) and the following makes your current dir a website running under 8082 (pwd).
mkdir wordpress
cd wordpress
git clone https://github.com/WordPress/WordPress.git .
docker run -p 127.0.0.1:3306:3306 –name some-mariadb -e MARIADB_ROOT_PASSWORD=PASSWORD -d mariadb:latest
docker run -d -p 8082:80 –mount type=bind,source=”$(pwd)”,target=/var/www/html php:apache
- In /usr/local/etc/php/php.ini extension=mysqli is uncommented (and uncommented others) (so i edited this file)
- I can connect to MariaDb and make databases and stuff
I make a new file: info.php:
if ( function_exists( 'mysqli_connect' ) )
{
echo "exists";
}
else
{
echo "does not exist";
}
phpinfo();
The problem: The output in the browser shows "does not exist".
(phpinfo() phpinfo shows the lib mysqlnd 8.0.11)
This means that WordPress gives the same Error since this the code that WordPress uses.
So why... can it not find the function / extension while phpinfo gives the details.
I do something wrong which could well be.
Ref:
- https://hub.docker.com/_/mariadb official image
- https://hub.docker.com/_/php official image
- https://github.com/WordPress/WordPress.git official mirror repo
update I noticed '--with-mysqli=mysqlnd' was not in the phpinfo screen above. So I unpacked the tar file (in the docker image ofcourse) and
- ran the same config command that phpinfo gave appended with '--with-mysqli=mysqlnd' (but had to install in-between various apt-get xxx-dev libs including apache dev libs, libxml-dev, sqlite3-dev, libssl-dev, zlib1g-dev, libcurl4-openssl-dev, libonig-dev, libreadline-dev, libsodium-dev, libargon2-dev)
- ran make
- ran make install
- restart
this solved the prob.