Kevinleary.net, LLC.

WPEngine Sage/Blade Templates Broken 1/18/2023

On 1/18/2023 numerous WordPress sites using the Roots Sage theme began experiencing issues on WPEngine. If you are a developer or WPEngine customer experiencing trouble with the roots sage theme or blade template compiling, then this fix may save you trouble.

Previous Approach (broken 1/18/2023)

Prior to today, the following approach worked well to get sites built with the Roots Sage theme working on WPEngine:

define('SAGE_CACHE_PATH', '/tmp/sage-cache-' . PWP_NAME);

This approach stopped working today, and began throwing file system related errors. WPEngine support was unable to assist, but did mention that they were experiencing a high volume of similar requests:

We are having some internal issues with our systems right now that our engineers are working really hard on to fix which I think might be related here.

Related Errors

If you’re seeing a blank white screen on your WPEngine hosted website and there are errors similar to the following in your error log that began today then you’re likely experiencing this issue.

PHP Warning: include(): Failed opening ‘/tmp/sage-cache/{WPESITE}/a5deac12347f3ee417f92c602d65f720062925e2.php’ for inclusion (include_path=‘.:/usr/share/pear/php:/usr/share/php’) in /nas/content/live/{SITENAME}/wp-content/themes/{THEME}/vendor/illuminate/view/Engines/PhpEngine.php on line 43

It won’t be exactly like this, but similar and will mention include(): Failed opening for inclusion.

Working Fix

While working on this issue over an SSH connection, I noticed that the home directory for a site contained a tmp directory, which is new and something I haven’t previously seen before. I switched the compile location to use this directory, and the PHP errors and template compile issues have been reliably resolved for the entire day so far.

define( 'SAGE_CACHE_PATH', sys_get_temp_dir() );

This approach leverages this new user level tmp directory for storing compiled templates, which appears to be a stable way to correct the issue. I’ve been monitored access logs after implementing the following correction and have seen no similar issues occur. I believe this is a solid fix for the time being.

Filesystem Writes on WPEngine

This problem occurs for anyone hosting a WordPress theme that uses blade, Twig, or another template language that compiles on the fly or otherwise writes to the filesystem dynamically then you may have experienced issues with WPEngine hosting today, Wednesday 1/18/2023.

WPEngine provides two security features, Disk Write Limitations and Disk Write Protection, that are known to cause issues with themes and plugins that write to the file system. Popular themes doing this includes:

  • Roots Sage w/Blade Templates
  • Upstatement’s Timber Twig Plugin](https://upstatement.com/timber/)
  • Any other theme that compiles or stores files or data into the /tmp directory on WPEngine

Related Resources

Meet the Author

Kevin Leary, WordPress Consultant

I'm a freelance web developer and WordPress consultant in Boston, MA with 16 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.