• Resolved Theo Pape

    (@theo38)


    Hi there,

    How to use getenv() variables in w3tc-config/master.php? It seems not to accept PHP and can only be JSON in the file after the exit? What’s the point of the PHP file if that is the case and do you have a way to use environment variables in the settings?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @theo38

    Thank you for reaching out and I am happy to assist you with this.
    You can use WP-CLI and set config values using it:

    usage:
     wp w3-total-cache cdn_purge
     or: wp w3-total-cache fix_environment [<server>]
     or: wp w3-total-cache flush <cache> [--post_id=<id>] [--permalink=<post-permalink>]
     or: wp w3-total-cache import <filename>
     or: wp w3-total-cache opcache_flush
     or: wp w3-total-cache option <operation> <name> [<value>] [--state] [--master] [--type=<type>] [--delimiter=<delimiter>]
     or: wp w3-total-cache pgcache_cleanup
     or: wp w3-total-cache pgcache_prime [--start=<start>] [--limit=<limit>]
     or: wp w3-total-cache querystring

    I hope this helps!

    Thanks!

    Thread Starter Theo Pape

    (@theo38)

    Using this wp w3-total-cache option ? Can you give an example of setting a value?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @theo38

    Thank you for your feedback.
    You can use it like inexample below:

    wp w3-total-cache option set pgcache.enabled true --type=boolean
    wp w3-total-cache option set pgcache.engine file_generic

    /wp-content/plugins/w3-total-cache/Cli.php#L256 has details for usage.
    wp-content/w3tc-config/master.php has the config keys.
    /wp-content/plugins//w3-total-cache/ConfigKeys.php#L341-L680 has the defaults.

    file_generic is the default, so the second command is not needed, unless another engine was previously set.

    I hope this helps!

    Thanks!

    Thread Starter Theo Pape

    (@theo38)

    Brilliant, thank you.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @theo38

    You are most welcome!

    We would really appreciate it if you could take a minute and post a review?here. This will help us to continue offering a top-notch product to users.
    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Environment variables w3tc-config/master.php’ is closed to new replies.