<?php echo "Hello Again, World!"; ?>
Note: If upgrading to VMB 2.5 from a previous version, please read the upgrade instructions.
Greetings and salutations.
This is my second blog, which is here to serve as a repository for the really die-hard geekery that I feel just doesn’t belong in my regular blog. When I realized the need for a second blog, installing it ended up being a longer process than i anticipated, and I thought I would share the fruits of my experience.
Let me step back for a moment. I am a true hacker at heart, in the traditional sense: I love to pull things apart and take a look. To see how they work and how they might work better. I’m also an avid Mac-head, and since the rise of OS X, I’ve been learning the ins and outs of its Unix-like underbelly.
In a nutshell, my computer is highly customized.
A few years back I got a second computer — a laptop — and quickly discovered that while keeping one computer tweaked to prime operation just the way I like it is kind of fun, trying to keep two computers in such a state, and relatively synchronized, is a frustrating exercise in futility.
I also know a good bit of web coding. As I’ve been working with WordPress for a couple years now, I’ve come across a number of good plugins and expansions along the way. Beyond issues involved with installing them, (which is admittedly pretty easy, usually) over time I have to keep up with updates to these — not to mention updates to WordPress itself. From time to time I even delve into the plugin files myself and make improvements….
And I want to put in a second blog? Am I nuts??? Thinking of what a pain it would be to maintain two copies of WordPress, I started looking into the various multi-blog solutions people have come up with. Most of them involve a lot of weird modifications to several files and basically comprise major modifications to large swaths of the WordPress code that are fundamentally incompatible with the regular version.
I am a great fan of what I consider “elegant” coding, which means that the designer does his job with the simplest and most straightforward methodology possible. And I found a very elegant solution to the “multiple blog on one install” question. Allan Mertner came up with something that blew me away with its simplicity and power.
WordPress holds all of its data in a MySQL database, and there is a single file called wp-config.php that holds the database login information. Allan looked at this and realized that if you can change that one file, you can completely replace the blog. With this key realization he came up with a cunningly straightforward multi-blog system:
- Replace the standard wp-config.php file with a new version that calls a different configuration set depending on what directory it’s in.
- Set up symbolic links that serve as “virtual directories” that all point to the WordPress directory.
Using the example of this site, I have an install of WordPress in the root web directory, and a symbolic link called “nerdaphernalia” (that’s right, you’re soaking in it!) that points back to the root. The modified wp-config file points to either the default or nerdaphernalia config file, depending on which of those two directories it thinks it’s in.
So other than a happy user, where do I come in in all this? Well, I made a number of improvements. First, Allan’s system was great, but it required us to install various files in and around the core WordPress files, which for me at least defeats part of the purpose of using a multiblog system in the first place. I’m trying to make updates easier, remember? Updating WordPress generally involves deleting everything but the wp-config.php file and the wp-content folder, and then dropping in the new versions of everything else; but if there are important but non-standard files strewn about, I can’t just do that. I have to remember to go through and preserve those files, and then replace them when they’re done. Add in a few plugins that work the same way, and we have a real hassle.
So first off, I tucked all the files, except for the one modified wp-config.php, into a folder in a safe place. Next, I greatly streamlined the install process. At a minimum, the user only need edit a single configuration file, autoconfig.php. If desired, the various blogs can each have individual config files, but it’s no longer necessary.
I’ve added user-accessible functions (and the really handy VUSER constant) that can be used in themes and plugins. I’ve added the ability to customize the location of the configuration files, so the security-conscious can move them entirely out of the Web directories if they wish. Overall, we are left with a easy but powerful system for running virtually any number of blogs off a single install of WordPress.
Install instructions are included with the download. Still have questions? Check out the readme and the FAQ. (Note: Sometimes the readme will list a higher version than the download. That happens if I have a development version installed.)
User “JZ” is selling written instructions for installing the system. (Please Note: I have not even seen his instructions, I’m just letting you all know.) More info in this comment.
…And if the directions are worth money to you, perhaps the actual software is worth something as well?
Download
Here’s what you’re really looking for: the download link. Have at it!
History/ Acknowledgements
For a detailed history, please see the readme file in the download.
Many of the improvements to version 2 were based upon or inspired by commenters to my blog. To them, and to everyone who has sent comments, I am grateful.
Good luck. Have fun.

684 Comments
Pages: « 1 … 25 26 27 28 29 [30] 31 32 33 34 35 » Show All
Hi Steven,
FYI, I discovered and fixed a couple of bugs / annoyances in the VMB code. See the patches at
- http://pastebin.com/m739b3381 (wp-config.php)
- http://pastebin.com/m7ffbf5f6 (vmb-core.php)
Thanks. I was about to re-add the ABSPATH define anyway, following a discussion on the wp-hackers mailing list, but I definitely didn’t know about the other issue.
FYI though , any functions calling wp-config.php directly (where the ABSPATH stuff is needed) are not programmed properly. In some cases ABSPATH will not be correct, and that will cause issues. If a plugin absolutely must access the config info, it should probably best call wp-load.php instead. (Though I am told that even that is wrong, it’s a simple fact of life that many plugins call these files, and it’s therefore irresponsible for me to knowingly break them.)
I’ll get the new update out this weekend, probably.
You are a very patient man, Stephen! I am a musician not a coder and have tried to read this ENTIRE comment thread before I pestered you.
I have a working WordPress installation at http://weddingmusicinnc.com/blog and have pointed its custom domain name http://weddingsinnc.com to it. That works fine.
I just bought http://best-wedding-music.com
I installed your software as instructed (or at least tried).
http://www.best-wedding-music.com is currently successfully pointed to
http://weddingmusicinnc.com/blog/best-wedding-music
but
it delivers the template of the original blog (http://weddingmusicinnc.com/blog) with a 404 NOT FOUND instead of a post
well, duh, because I can’t figure out how to log on to the new blog!
Is it supposed to show up as a tab on the “old” blog’s dashboard? it doesn’t.
Am I supposed to be able to access it using some variation of wp-admin/edit.php ? the ones i’ve tried give me a 404 too.
I did make
mb-autoconfig-weddingmusicinnc_com_blog_best_wedding_music.php
and loaded it to the config subfolder. It looks like this:
==========================
+V9OjqxYdIrTmXz iq\\Ms}?(;_a#ypoR5\’3wFL~1X’);
define(‘SECURE_AUTH_KEY’, ‘-\”r642fed3E1d>}MdGFlh@tR!QPU%/!S_6;CjO0}^>6TV9OjqxYdIrTm+ OG<U$%u0:9H:Jl)+d$~jIBTt&CPL[Dp
==================================
what have I done wrong?
Hmm, my attempt at adding the config file seems to have failed. Tell me how to send more info if you need it?? Thanks to people who give of their time so generously. That guy who’s trying to make $25 off of you, how brazen he is. Heh.
“That guy who’s trying to make $25 off of you, how brazen he is. Heh.”
Nothing brazen about it. He provides a service and charges for it. No different than going to a store and seeing a “How to use WordPress” book, really. (Though he might sell more if he charged less.)
If you want to show me a config file, see this link.
Since nobody has helped yet, I fear I am digging my hole deeper and deeper.
==========================================
At start of this process:
==========================================
I have wordpress installed in http://weddingmusicinnc.com/blog and
there IS a wordpress blog at that location currently functioning.
Its name is http://weddingsinnc.com
==========================================
Goal:
==========================================
I want to add a blog called http://best-wedding-music.com
and I want it to point to
http://weddingmusicinnc.com/blog/best-wedding-music
==========================================
What I’ve tried:
==========================================
I submitted my config files to you via email.
——————————————-
I could not get help from the tech folks at webhostingpad.com so I tried to do a symbolic link myself with a php file. Since I believe you suggested a symbolic link pointing back to the directory where wordpress is installed, named with the subdirectory name, I used this syntax:
—————————————–
Result of that symlink:
——————————————
when I put http://www.best-wedding-music.com in the browser it transfers to this URL:
http://weddingmusicinnc.com/blog/best-wedding-music
THAT’S PERFECT
but the page I get is:
————————————————-
Forbidden
You don’t have permission to access /blog/best-wedding-music on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
===========================================
When I look in my CPanel, I see there is a new file in the /blog directory called best-wedding music and the new file says:
—————————————-
best-wedding-music
broken symbolic link to ‘~/public_html/weddingmusicinnc.com/blog’
Not Found
The server was not able to find the document (/home/asz8nvcx/public_html/weddingmusicinnc.com/blog/best-wedding-music) you requested.
Please check the url and try again. You might also want to report this
error to your web hosting provider.
cpaneld/11.24 Server at 69.65.10.232
————————————————
WAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHH!!!!
Please, what’s wrong?
[Update: This thread continued via private email.]
Virtual Multiblog 2.6.2 is out!
* Restores ABSPATH define in wp-config.php. Some plugins (improperly) call wp-config.php directly & we should try not to break those.
* Fixes “PHP bad offset” bug. props Hackadelic
[...] have a Linode (VPS) set up at http://www.linode.com/ with Apache 2.x, WordPress 2.8, Virtual-Multi-Blog plug-in (which really isn’t a plug-in – but rocks), Rails, Git, and a few other [...]
Stephen:
I just now made a small donation to you for all your hard work on VMB.
I hope more people will donate something this month, too!
After a couple of hours reading here and on Hackadelic, I have a few questions. I am not technically advanced.
I have about 100 sites that I want to convert from Joomla to WP. I have an unusual host that has my sites spread over 11 different servers. Each site is a different domain.
So, I want to run 100 domains, on 11 servers, from one system, likely VMB.
Will it work over multiple servers?
Secondly, I am unclear about the differences between running VMB, versus WPMU using the Domain Mapping plugin from Donncha.
http://wordpress.org/extend/plugins/wordpress-mu-domain...
Similarly, there are several possible solutions for doing this listed on Wp.org, but most of them seem weak, or outdated, or no longer supported. Any thoughts on these?
http://codex.wordpress.org/Installing_Multiple_Blogs
I am just fuzzy on the higher-level view of all my options.
I appreciate your time.
Interesting, and I’m curious about the explanation for that. Why would ABSPATH be incorrect “in some cases”? And what cases will that be?
Hackadelic — As of (I think) WordPress 2.6, the wp-config.php file can be moved up one directory from the other WordPress files. If WP is set up that way, (as it is on this site), any direct calls to that file will result in an incorrect ABSPATH being set.
Of course anything trying to call the file will error out before that, because it won’t be where it’s expected to be.
From recent discussion on wp-hackers, it basically comes down to this: You should *never* have to call wp-config.php directly, but coders who don’t know any better do so anyway.
My take is that if you absolutely must call configuration fles directly from a plugin, call wp-load.php instead. (That isn’t really correct either, but may be a decent quick-fix.)
Doug — First off, the entire point of VMB is to save some work keeping files up to date, by running one set of files at multiple URLs. Thus, having the WordPress files on different servers doesn’t apply — it defeats the purpose. You should be able to run it with the *databases* on different servers, with each blog calling different database info. It could probably also be run on multiple servers if you’re talking about a “load distribution” setup where the exact same data is kept on multiple servers. (But I doubt that’s what you’re referring to.)
RE: WordPress Mu — The main difference between the two is that on MU, there is one admin that contgrols all the sites. On VMB, each site/blog is completely separate, with separate users, and separate admin. In VMB, one install of WP doesn’t even know of the existence of the others. (That may change somewhat in the future, but the admin sections will basically remain the same, most likely.
Another difference is that VMB is much more compatible with plugins than MU. There are only a few plugins I know of that do *not* work with VMB. Not so with MU. (With VMB, plugins that affect .htaccess can be problematic or not work at all. This unfortunately includes caching plugins).
Thanks for the donation. Though small as you say, your donation composes exactly 1/7 of *all* donations this site has received in 2009.
Steven, thanks for the explanation.
I didn’t know that thing about wp-config.php. Would yu point me to material that explains it in more detail? I’m interested in the advantages of and techniques for such setup.
I noticed the problem with ABSPATH in conjunction with a plugin I’ve been using with VMB 2.5 that just stopped working after the upgrade to 2.6. I tracked it down to an AJAX call that invoked a php file in the plugin directory directly.
The question is: If calling wp-config.php is bad, and calling wp-load.php is bad too (as your wp-hackers say), then what’s the way for an AJAX script to obtain WP configuration info.
Some more thoughts:
Also, I know wp-config.php still includes the definition of ABSPATH. If that’s wrong, why is it still there? I guess for the same reason why you had to include it: To not break plugins. So it seems plugins that obtain ABSPATH via wp-config.php are pretty much the rule. Consequently, many plugins would just stop working if wp-config.php is moved to a different location. Which brings me back to the question about the advantage of doing so. Does it outweigh the annoyance of being forced to do without all those plugins?
Oops, I mistyped your name, Stephen, sorry!
I’m creating a new website using your software. Except for the site search (which should work fine if Google indexes me), I am having a minor issue with the URLs. The root blog and anything in the root blog show up with the URL “http://www.bentz50.com/whatever”. But when I go to a blog in a subdirectory I get “http://bentz50.com/rants/whatever”. So basically I would like the “www.” added to the subdirectories, but I cannot figure out whether it is the default rewrite rules provided in your documentation or if it is something that cannot be fixed easily. Any help would be appreciated.
Thanks
Stephen:
Thanks for the reply. You wrote:
“You should be able to run it with the *databases* on different servers, with each blog calling different database info.”
———-
So do no other VMB users do this? I want to run just the one instance of WP, on one domain, with all the 99 other domains, about 9 per server, feeding off of the one mothership. Would that work?
Secondly, I still cannot figure out which is the better way to go…. meaning less hassle and time consumption over the long haul. VMB would be less hassle for updating plugins and themes and WP itself …. but would require going to each domain, logging in, and adding a post. Right?
MU would be less hassle to post because I can do so from ONE interface, without going to each domain to log in, but more hassle in keeping things up to date?
Does that sound right?
(I realize I sound clueless, sorry)
Doug,
I have previously installed this and modified the installation and DB to have one domain and x aliased domains sharing the same users and files. I then used plugins and some simple PHP code to display specific logos, footers, links, and categories depending on the domain or aliased domain. This worked great to allow me one log in to manage everything.
I am now upgrading to the latest version of WP, pretty much starting from scratch. I’ll document my steps and post it here or share a link to the info in the next 2-3 days.
Matthew
You cannot use one instance of VMB or MU to manage sites on multiple physical servers or VPSs. If you have nine servers or VPSs you would need and install an instance VMB or MU on each. Then each instance can manage unlimited domains on each.
You are correct with MU you have one login and switch between blogs to make your posts. The problem with using MU is it does not support a wide array of plugins or themes. If you were going to go with MU you make sure all your plugins and themes of choice are support. I have yet to run into a plugin that VMB does not support.
Also, from what I recall. MU is not nearly as easy to install for multidomain use.
Matthew:
That sounds FANTASTIC! I can’t wait to see your steps.
DNDCO:
Thanks. Bummer. My hosting account has 11 shared servers actually, so this would be frustrating. I am really starting to regret my setup, which was originally meant for SEO purposes and “hiding” a network of sites from Google.
Which probably doesn’t work anymore anyway….!
Just a quick side note for everyone with a “-” in the domain name. exam-ple.com.
The VUSER is configured like this:
$vusers[] = ‘exam-ple.com’;
Your mb-config needs to be this:
mb-config-exam_ple_com.php
This isn’t real clear from reading the read-me..
Love VMB thanks for making multiblog simple. It saves me a great deal of config. time.
madberry
Pages: « 1 … 25 26 27 28 29 [30] 31 32 33 34 35 » Show All