• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP Bitz

A curated collection of code snippets for WordPress

  • Home
  • About
  • Blog
  • Code Snippets
You are here: Home / WordPress Development Tips / Bitnami WordPress Autoptimize cannot write to the cache directory

Bitnami WordPress Autoptimize cannot write to the cache directory

WordPress Development Tips · December 15, 2022

This post brought to you by RocketGeek, ButlerBlog, and the following:

 

If you are running the Bitnami WordPress stack. unsing the Autoptimize plugin, and get the “Autoptimize cannot write to the cache directory” error, there is a simple solution that does not involve reinstalling the plugin.

If the folder permissions are not correct, you may get the following error from Autoptimize:

Autoptimize cannot write to the cache directory (/opt/bitnami/wordpress/wp-content/cache/autoptimize/), please fix to enable CSS/ JS optimization!

To solve this, some suggestions on the internet involve deleting the /autoptimize/ folder, deactivating (or deleting) the plugin, and then reactivating.

You do not need to do that!

You can solve the problem without deleting the existing cache and without reactivating or reinstalling the plugin. All that is necessary is to restore the proper WordPress filesystem permissions. But first, it’s probably a good idea to understand what permissions Bitnami uses for its WordPress stack.

Bitnami applies the following default permissions to WordPress files and directories:

  • Files and directories are owned by the user bitnami and group daemon.
  • Directories are configured with permissions 775 by default.
  • Files are configured with permissions 664 by default.
  • The wp-config.php file is configured with permissions 640.

To solve the Autoptimize cannot write to the cache directory when using Bitnami WordPress, all you need to do is restore the correct permissions via SSH with the commands below, replacing TARGET with the WordPress application folder:

sudo chown -R bitnami:daemon TARGET
sudo find TARGET -type d -exec chmod 775 {} \;
sudo find TARGET -type f -exec chmod 664 {} \;
sudo chmod 640 TARGET/wp-config.php

Note that you need to change TARGET to the WordPress application folder. The simplest way to work this is to move yourself into the /stack/ folder (if you’re using the newest Bitnami WordPress stack) and then you can simply replace “TARGET” with “wordpress“.

Filed Under: WordPress Development Tips

Chad Butler

This post brought to you by RocketGeek, ButlerBlog, and the following:

 

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Join for free!

Get free code snippets, WordPress best practices, and practical Content Marketing advice from seasoned WordPress expert Chad Butler (butlerblog):

Recent Posts

  • Bitnami WordPress Autoptimize cannot write to the cache directory
  • Create and delete WordPress sites in XAMPP with a batch file
  • How to fix “Error: MySQL Shutdown Unexpectedly” in XAMPP control panel
  • Fix missing Customizer in WordPress 6
  • Use Proofy.io API to validate WordPress registrations

Copyright © 2023 · Maker Pro on Genesis Framework · WordPress · Log in