Bryan's thoughts on web design and development

Zend Optimizer + APC = death

Our supporttrio support ticket installation went down last night. Their code is protected via Zend Guard, which requires Zend Optimizer to be installed.

Our site is served and managed by Rackspace. Last night I realized that I should actually use their services rather than keep installing things myself. So I asked them to install APC.

All seemed a-okay. Unfortunately, supporttrio wasn’t on our Pingdom web monitoring account, so we didn’t know about its death until the next morning. No harm done except a few delayed tickets, but this was an unexpected surprise. Disabling APC caused the site to come back up.

Moral of the story: APC + Zend = Death. Google knows more about why; I can only infer it may be a namespace conflict, or perhaps even a misguided attempt at competition (Zend has their own cache product). I don’t really need to use APC, so I didn’t investigate, but I figured I’d save someone else the headache of discovery.

Hope this was helpful.

Setting up multiple blogs with a single Wordpress install

I wanted to enable the rest of the Xobni team to create their own personal blogs, giving them the freedom to communicate their technical ideas and discoveries with the world. Unfortunately, while Wordpress supports multiple users, it doesn’t allow each to have distinct themes and posts. The recommended workaround is to install Wordpress multiple times, or use a completely separate fork of called Wordpress MU; both options sound every bit as exciting as this looks.

After some googling, I found a unique solution by Stephen Rider, which allows you to symlink multiple directories to a single wordpress install. I changed a few things, introducing svn updates and a simpler blog replication process. I will detail my changes below:

Check Out the latest Wordpress via Subversion (SVN)
Wordpress is a constantly evolving system - each update brings with it useful new features and bug fixes. You could install Wordpress by downloading it from their site and uploading it to your server - but that means either that you’re forever stuck with the same version that you downloaded or that you must undertake a complicated upgrade procedure. Instead, check out Wordpress via SVN to a directory like /blog/ and SVN will do all the merges for you:

  1. Navigate to your root directory (or wherever you want to your blog) using ssh
  2. Run the command:
    svn co http://svn.automattic.com/wordpress/trunk/ blog
    (change ‘blog’ to whatever you want to name your default blog. You’ll need to install subversion first if you don’t have it)

Now, when you want to upgrade to the latest and greatest Wordpress, all you need to do is run ’svn up’ in the root of your blog’s directory. If you’re not familiar with subversion, you really should be using it for your site as well, but I’ll save that for another post.

Download and follow Stephen’s instructions
Stephen does a great job at explaining how to set up wordpress to support multiple blogs in one install, so I won’t steal his thunder - install his fixes by following his instructions, skipping the part where he talks about replicating the mb-config-sample.php.

Now, you could use multiple databases per blog. That’s all well and good, but it means that setting up a new blog will require you to log into mysql and create a new database and set up user permissions each time, not to mention changing the files in the wordpress install as detailed in his instructions. Headache.

I’d much prefer to use one database with different table prefixes for each new blog. For example, for this blog, http://xobni.com/bryan, the table for blog entries is named ‘bryan_posts’ instead of the default ‘wp_posts’. One database, lots of tables. And wordpress will create them for you automagically. Less headache.

To set it up this way, all you have to do is change the new wp-config.php in your blog’s root (as taken from Stephen’s zip file), and comment out line 38 where it says:

$configfile = ‘mb-config-’ . $user . ‘.php’;

That ensures that wordpress always uses the default config file. Now, open /multiblog/mb-config-sample.php and change line 11 where it says:

$table_prefix = ‘wp_’;

To:

$table_prefix = $user. ‘_’;

Then simply rename mb-config-sample.php to mb-config-default.php. This essentially sets up your new multiblog wordpress to prefix each new blog’s tables as ‘blogname_’. When you run the Wordpress setup for each new blog symlink, it will create those new tables for you - no need to touch phpMyAdmin nor replicate any new mb-config-blogname.php files. With how fast we’re hiring, this makes my job even easier.

I hope this was helpful.