View Categories

Eval Fallback Mode

What it is #

By default, GOCSM writes PHP snippets to disk and loads them via require_once. On some managed hosting environments, the web server process does not have write access to wp-content/uploads/. Eval fallback mode allows GOCSM to function in those environments by executing snippet code via eval() instead.

Modes #

Mode Behaviour
Off (default) File generation only. If the filesystem is not writable, activation fails with an error.
Auto Try file generation first. Fall back to eval if the write fails or the generated file is missing at runtime.
Always Never write PHP snippet files. Every PHP snippet runs through eval, including any snippet that still has a file from an earlier mode. Useful when a host or security scanner rejects PHP files in wp-content/uploads/. JavaScript and CSS snippets are still written as files.

Configure the mode under Settings > Eval fallback mode.

Config injection in eval mode #

Config values are still injected before evaluation. GOCSM replaces config block values with your stored values, strips the leading <?php tag, then passes the result to eval().

Limitations of eval mode #

  • No OPcache benefit — the code is recompiled on every request.
  • Stack traces show eval()'d code instead of a real file path, which makes debugging harder.
  • Some security hardening tools block eval() outright.

Eval fallback is provided for compatibility only. File-based execution is strongly preferred.

Active PHP snippets that run through eval show an (eval) badge in the snippets list: every active PHP snippet under Always, and under Auto any whose generated file is missing. Under Auto, an admin notice also counts the snippets that have fallen back to eval, since that usually means the filesystem stopped being writable.