0

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".

enter image description here

(phpinfo() phpinfo shows the lib mysqlnd 8.0.11) enter image description here

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:


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.

1 Answer 1

0

In this docker image php compilation a package is missing.

  1. get inside the image and unpack the php tar
  2. copy the config of phpinfo and append '--with-mysqli=mysqlnd'
  3. install missing packages (various) 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 (with apt-get install xxx)
  4. run make
  5. run install
  6. restart

And this will be solved.

Or... search for an image on docker hub that has this.

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.