Resolving issue with tmp directory

On some hosting environments, when using CSS and/or JS minification, you might notice that your website looks broken, and if you look inside the minified files, you see this:

PHP Warning: is_file(): open_basedir restriction in effect. File(/tmp/fontawesome.min.css) is not within the allowed path(s)

This means that the default path for the server’s tmp directory WP Rocket is trying to use is not the correct one.

To fix the issue, you can modify the path to the tmp directory by using the helper plugin below:

Helper Plugin

📝 Manual code edit required before use!
You must replace /path/to/tmp_dir/ with the absolute path to your custom tmp directory before you activate this plugin!

📥  Download (.zip): WP Rocket | TMP Directory

Developers: You can find the code for this plugin on GitHub.

One way to use this plugin would be to enter the path to your server’s default tmp directory, but you can also define a new folder to serve as your tmp directory for WP Rocket.

For example, you would create a new folder named tmp inside of /wp-content/cache/. Then you would edit the plugin’s return line to look like this:

return trailingslashit( WP_CONTENT_DIR ) . 'cache/tmp/';

However, keep in mind that a custom tmp directory will not be cleared out automatically! If you use this approach, make sure the temporary files in your custom tmp directory get removed every once in a while.