Wordpress compose did not work correctly
I tried it on an installation with Ubuntu 22.04 lts, and apparently it had installed successfully.
1.When I clicked this message appeared: “Error establishing a database connection”.
1.1. So I went to check the environmental variables, they were correct.
1.2. I checked the web ui connections, network, ports, everything was fine.
1.3. I went to check the wp-config.php and wp-config-docker.php files, they were wrong.
1.3.1. Then I edited these parameters based on the configured environmental variables:
define( 'DB_NAME', getenv_docker('WORDPRESS_DB_NAME', 'insert') );
define( 'DB_USER', getenv_docker('WORDPRESS_DB_USER', 'insert') );
define( 'DB_PASSWORD', getenv_docker('WORDPRESS_DB_PASSWORD', 'insert') );
define( 'DB_HOST', getenv_docker('WORDPRESS_DB_HOST', 'insert') );
$table_prefix = getenv_docker('WORDPRESS_TABLE_PREFIX', 'insert');
- it still didn’t work.
1.4. So I went to mysql and the folder had nothing (it just created the folder).
1.5. So I decided to install it separately.
1.5.1. First mysql with its database, network (bridge) and ports settings.
1.5.2. Then wordpress:
1.5.2.1. With the environmental variables, it worked.
1.5.2.2. Without the environmental variables (internal configuration), it worked.
So I tested it on a machine with Debian 11 and compose worked perfectly.
- I didn’t understand the error, but if anyone has this problem, I solved it like this, if anyone has another solution please share.