Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with wp-config.php file #573

Closed
kasztof opened this issue Mar 11, 2021 · 4 comments
Closed

Problem with wp-config.php file #573

kasztof opened this issue Mar 11, 2021 · 4 comments

Comments

@kasztof
Copy link

kasztof commented Mar 11, 2021

Hi,
we were using wp-config-sample.php file to keep some project specific variables e.g.

define( 'SFTP_PATH', dirname( __FILE__ ) . '/sftp' );

Everything was working fine, however today when the project was rebuilt, I got an error in the logs, that one of our custom variables defined in wp-config-sample.php is undefined. Additionally at the start of the container there is this message:

No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying '/usr/src/wordpress/wp-config-docker.php' (WORDPRESS_AUTH_KEY WORDPRESS_AUTH_SALT WORDPRESS_CONFIG_EXTRA WORDPRESS_DB_HOST WORDPRESS_DB_NAME WORDPRESS_DB_PASSWORD WORDPRESS_DB_USER WORDPRESS_LOGGED_IN_KEY WORDPRESS_LOGGED_IN_SALT WORDPRESS_NONCE_KEY WORDPRESS_NONCE_SALT WORDPRESS_SECURE_AUTH_KEY WORDPRESS_SECURE_AUTH_SALT)

I just discovered that there was PR merged few days ago, introducing wp-docker-config.php. I checked the repo, and https://hub.docker.com/_/wordpress/ but I couldn't find any helpful documentation on this problem. Will I still be able to use the previous setup with wp-config-sample.php, or do I need to switch to wp-docker-config.php? If so, how can I define custom variables?

@swissspidy
Copy link
Contributor

Could you just use WORDPRESS_CONFIG_EXTRA for that?

@tianon
Copy link
Member

tianon commented Mar 23, 2021

Indeed, WORDPRESS_CONFIG_EXTRA is the appropriate solution for additional configuration (or modifying the installed copy of wp-config.php directly, if you prefer).

@tianon tianon closed this as completed Mar 23, 2021
@matzeeable
Copy link

Hey @swissspidy and @tianon !

I just stumbled over this, and we are using wp config set in our Docker environment alot. Now, after our images got updated to the latest version, we can no longer use configuration set at runtime:

Error: Could not process the 'wp-config.php' transformation.
Reason: Unable to locate placement anchor.

I just tried a workaround and if I add /* That's all, stop editing! Happy blogging. */ to the following line it works as expected:

/* Add any custom values between this line and the "stop editing" line. */

@tianon
Copy link
Member

tianon commented May 24, 2021

Yep, sounds like you're running into what caused WordPress/WordPress@cbcd3ff (which we've applied in 1d90641 but not quite published yet).

Given it's breaking WP-CLI, I've opened docker-library/official-images#10227 to get that comment change pushed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants