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

WORDPRESS_CONFIG_EXTRA is not evaluated #771

Closed
juliankrieger opened this issue Nov 18, 2022 · 3 comments
Closed

WORDPRESS_CONFIG_EXTRA is not evaluated #771

juliankrieger opened this issue Nov 18, 2022 · 3 comments

Comments

@juliankrieger
Copy link

juliankrieger commented Nov 18, 2022

I've read #557 , #332 and #142 because the content of my WORDPRESS_CONFIG_EXTRA file does not seem to be evaluated. To check for this, I throw fatal errors in the code that should normally be evaluated, but I can see no such error in my error logs. Is this behaviour broken again?

Things I tried:

  • Deleting my images and rebuilding them entirely
  • Opening a terminal into my wordpress-blog container and deleting wp-config

Docker-Compose File:

version: '3.4'

x-common-variables: &common-variables
  FSHM_HOST: *******
  MYSQL_DATABASE: *******
  MYSQL_USER: ******
  MYSQL_PASSWORD: ******
  MYSQL_ROOT_PASSWORD: ******
  WORDPRESS_TABLE_PREFIX: *******
  WORDPRESS_DB_HOST: db
  DEVELOPMENT_DATABASE: ********
  DEVELOPMENT: true

services:

  wordpress:
    depends_on:
      - db  
    container_name: wordpress-blog
    image: wordpress
    restart: always
    ports:
      - 80:80
    environment:
      <<: *common-variables
      WORDPRESS_DB_USER: ******
      WORDPRESS_DB_PASSWORD: *******
      WORDPRESS_DB_NAME: *******
      WORDPRESS_DB_CHARSET: utf8
      WORDPRESS_DB_COLLATE: ''
      WORDPRESS_AUTH_KEY: ******
      WORDPRESS_SECURE_AUTH_KEY: *******
      WORDPRESS_LOGGED_IN_KEY: ******
      WORDPRESS_NONCE_KEY: ******
      WORDPRESS_AUTH_SALT: *****
      WORDPRESS_SECURE_AUTH_SALT: ******
      WORDPRESS_LOGGED_IN_SALT: ******
      WORDPRESS_NONCE_SALT: ******
      WORDPRESS_CONFIG_EXTRA: |
        $$is_development = getenv_docker('DEVELOPMENT', false) == 'true' ? true : false;
        trigger_error("$$is_development", E_USER_ERROR); // just to check if evaluation works in the first place
        if($$is_development) {
          define('WORDPRESS_DB_NAME', getenv_docker('DEVELOPMENT_DATABASE', 'fsweb_development'));
        }
    volumes:
      - type: bind
        source: ./wordpress/wp-content
        target: /var/www/html/wp-content
    tmpfs:
      - /tmp
      - /run

  db:  
    container_name: mysql-db
    image: mysql:5.7
    restart: always
    environment: *common-variables
    volumes:
      - type: bind
        source: ./database_content/mysql
        target: /var/lib/mysql

@hexclann
Copy link

hexclann commented Jan 3, 2023

@juliankrieger how did you fix it?

@MorgusLethe
Copy link

MorgusLethe commented Jan 17, 2024

I also added this variable and recreated my container, and echo $WORDPRESS_CONFIG_EXTRA from bash confirms that it is set (returns define('DISABLE_WP_CRON', true); ), but there is no such line in my wp-config.php. I also confirmed that my wp-config.php is not part of any docker volume, so this file should be rebuilt when I recreate the container. What am I missing?

EDIT: I expected that the variable's value will be entered verbatim in the wp-config.php file, as described in the link that is present on the docker hub wordpress page. This link is misleading (out of date) and I think it should be removed. If anyone else gets to this point from googling the issue, the code that is in "WORDPRESS_CONFIG_EXTRA" is just evaluated, and is not added to the wp-config.php file.

@tianon
Copy link
Member

tianon commented Jan 17, 2024

Doh yep, that's a result of #557

https://github.com/docker-library/docs/blob/822fa3726b041120f108d331e56ee7a412a4f193/wordpress/content.md#L24 would be the appropriate place to update that wording if someone wanted to take a stab at it 👀

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