Hosting

WordPress – WP Super Cache on Pagodabox

My blog is hosted on Pagodabox and it was almost 3 months of continuous tweaking to make it fit on Pagodabox environment. Just recently I have fixed my writable directory to support most caching plugin like WP Super Cache and W3 Total Cache.

WP Super Cache

WP Super Cache is a caching plugin for WordPress. It was great for my blog and it is doing a great job. However, upgrading it on my current setup requires modifying the plugin core to move its directories due to Pagodabox read-only environment.

With my new setup, it is no more a problem.

Writable directory

On my old post, I used a shared writable directory at wp-content/writable. This time, I moved the writable directory up to wp-content directory so that whatever plugin wanted to write, it is free to do so. Below is my directory structure.

wp-admin
wp-includes
wp-content-ro
  plugins
  themes
wp-content
  plugins -> ../wp-content-ro/plugins
  themes -> ../wp-content-ro/themes
index.php

My wp-content directory is moved to wp-content-ro. On my box file, I set wp-content as shared writable directory and on that directory, I created symlinks to plugins and themes inside.

Below is my Boxfile content:

web1:
  shared_writable_dirs:
    - /wp-content
  php_extensions:
    - eaccelerator
    - memcache
    - mysql
    - curl

We also need to update our .gitignore file to add wp-content to the ignored directory.

Thumbs.db
.svn
_svn
*.kpf
*.swp
.buildpath
.settings
*.komodoproject

/wp-content

We make sure that wp-content directory is deleted and cleaned up then deploy that version. Once deployed, login to the shared writable directory via SSH then set the symbolic links.

cd shared/wp-content
ln -s ../wp-content-ro/plugins plugins
ln -s ../wp-content-ro/themes themes

What we do above is create a symbolic link in wp-content for plugins and themes pointing to wp-content-ro directory. Although these directories does not exists in the shared writable directory, once deployed, they will point to our wp-content-ro directory as specified previously.

With this setup, we can install and setup WP Super Cache easily and have it create cache config and cache directories whenever it needs.

Enjoy Pagodabox!

10 thoughts on “WordPress – WP Super Cache on Pagodabox”

  1. Hi! Something I’m wondering, my git repo is not visible under pagodabox ie wp-content is not visible under my ssh console. Is it there but hidden ? How to do the sym link then?

  2. It should be in shared dir. No repo will be visible, just the shared writable dir.

  3. As you mentionned, only shared directories are visible. Does this mean that both wp-content and wp-content-ro are shared dir ? Do you mind pasting your Boxfile ?

  4. The boxfile is in the blog post. I have updated it to include everything on the Boxfile. wp-content is the only visible dir on shared writable dir, and of course the others that you declare in the box file.

  5. Have you ever experienced issues for wordpress to write the config files of a plugin? FOr ex for super cache, if I change a setting in the wp-admin section, the new settings is not saved in the config file… I have to open it with vim, save without any change, and then do the setting change again to have it *really* saved…

  6. Hi Spirit,

    In your repo, symlink your config and .htaccess file to a writable directory. That is what I’m currently doing right now and it works.

    Thanks

  7. Even without symlinks, if i make the whole wp-content writable, the config is not saved in the config file…

  8. There’s no need to add wp-content to .gitignore if you want to for example update plugins through git you can add to BoxFile

    after_build:
    – “mv wp-content wp-content-ro”

  9. Szymek – thanks for the tip. Its definitely an option. But when I did this old post, there is no deploy hooks yet or I may have not yet heard of it.

Leave a reply

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