So I tried to make a docker container with wordpress & postgres using the ntninja/wordpress-postgresql image but it still trie to use MySQL to connect wordpress to the db.
Here is my docker-compose.yml
and the result when i do
sudo docker-compose up:
I’m currently using wsl2 with windows 10.
My guess is that you have a local config in your
./wp folder which you mounted into the container and overwrote the db.php which sets the DB_DRIVER variable.to be psql.
Thank you for your response.
My db.php didn’t seemed to be overwriten because it looks like this :
I have an update ! I just waited and now it tries to connect to postgres, but didn’t succed :
even though I have the same connection infos for both wordpress & postgres :
and for postgres:
The dbd part of my wp-config looks like this :
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
/** Database Charset to use in creating database tables. */
/** The Database Collate type. Don't change this if in doubt. */
Well, yes, it tries to connect to the database server called “postgres”, but it tries to do that as if it were a MySQL server.
Are you sure that this is the file that WordPress loads? If you checked it only on the host, try to use docker exec to get inside the container, find the file where ou expect it to be, and read the content. For example:
head -n 17 db.php
to read the first 17 lines.Then change something on the host and check the content from the container again.
Then you can temporarily delete the whole content of the file without deleting the file itself. Try to connect again and if it gives you the same message, then there is an other file somewhere where the configuration comes from and the database driver is not set.
If you get an other error mesage, for example “undefined constant”, then I have no other explanation then a bug in the image and you should contact the maintainer of the image.
Just bumping this as I have the exact same issue.
Did you find a solution @hfifre?