Virtual Multiblog for WordPress

<?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:

  1. Replace the standard wp-config.php file with a new version that calls a different configuration set depending on what directory it’s in.
  2. 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!

Virtual Multiblog v2.5

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.

383 Comments

Pages: « 113 14 [15] 16 1720 » Show All

  1. #281 | Posted August 26, 2008 at 3:56 pm

    Just so Y’all know…

    I have a couple other pots on the fire at the moment, but I’m working on a new version of the system, and soon thereafter I intend to do a rewrite of the instructions. As I stated above, technical writing is difficult at best, and clearly there are parts of the setup that could be made more clear.

    Specifically, I think it was a mistake to try and combine subdomains and subdirectory/symlink into one example, as it clearly has many people thinking that you always use symlinks (among other confusion). To be clear: domains and subdomains don’t need symlinks; just point the different (sub)domains to the same “document root”. Symlinks are for when you want different directories with blogs in them, (e.g. “nerdaphernalia” on this site is not actually a directory, it is a symlink pointing back to the domain root.)

    Also, one issue that has messed up a lot of attempts to install this is trying to make it work alongside the WordPress method of having your blog in one place and the WordPress files in another place. It can be done, but my current instructions do NOT cover how to do it. That will be fixed as well.

    If you just want it working now, you can hire me to do it for you. Just drop me an email. Usually takes me about an hour, as I am (obviously) very familiar with the system.

    Stay tuned.

  2. jz
    #282 | Posted August 26, 2008 at 6:22 pm

    Stephen:
    I have written a lot of exact keystroke instructions fo rinstallation processes in my time and they seem to work because nobody ever said they misunderstood the directions or they did not work.
    I am trying to help not hinder so please don’t take what I said as an insult. My questions were to try and get clarity of the process that is all.
    If people DO NOT wnat to pay a small fee for easy installation instructions they do not have to. They can spend a few hours trying to figure it out. Which is worth more?

    In addiiton when I do get it figured out my intention was to send you part of the proceeds. So what is wrong with that?

    Thank you for your reply.
    JZ

  3. Erin Cox-Holmes
    #283 | Posted August 26, 2008 at 8:13 pm

    Stephen: Thanks for your previous response. It helped a lot. If I ever get this working, I’ll make a donation, and help with the install directions for subdomains.

    This is the error I am currently getting. I was having troubles getting it to see the DB, so I did a regular wp install to see if a vanilla install would work. After a couple of errors, it then told me that wp was installed and I should clear my db table. I don’t know if that has anything to do with it. (There are no contents in the db, so I could delete and put a fresh db in if it would help.)

    Error message:

    Warning: require_once() [function.require-once]: Unable to access /imedia/users/erinchlnx2/htdocs/wp-content/multiblog/vmb-functions.php in /imedia/users/erinchlnx2/htdocs/wp-config.php on line 25

    Warning: require_once(/imedia/users/erinchlnx2/htdocs/wp-content/multiblog/vmb-functions.php) [function.require-once]: failed to open stream: No such file or directory in /imedia/users/erinchlnx2/htdocs/wp-config.php on line 25

    Fatal error: require_once() [function.require]: Failed opening required ‘/imedia/users/erinchlnx2/htdocs/wp-content/multiblog/vmb-functions.php’ (include_path=’.:/usr/share/pear:/usr/share/php:/usr/local/lib/php’) in /imedia/users/erinchlnx2/htdocs/wp-config.php on line 25

  4. #284 | Posted August 26, 2008 at 11:14 pm

    Erin –

    Quite simply, PHP is looking for a file at /imedia/users/erinchlnx2/htdocs/wp-content/multiblog/vmb-functions.php and not finding it.

    Is the multiblog folder in the wp-content folder?

  5. #285 | Posted August 26, 2008 at 11:26 pm

    JZ — it was more the attitude than the content. “NO IT IS NOT THAT EASY” after having (apparently) completely skipped a step. Talking about how good you are at writing instructions, when your comment itself was difficult to read. (Among other things, you make no distinction between a quote and your own text….)

    As for selling the instructions — the “good luck with that” wasn’t entirely snark. I don’t think you will get a lot of customers trying to sell the directions outright, but I may be mistaken. People who deal with open-source have often become accustomed to getting things for free. See what happens.

  6. #286 | Posted August 27, 2008 at 11:01 am

    This might interest you all — how to call a different header file for each blog while using the same theme: read the article.

  7. #287 | Posted August 27, 2008 at 2:39 pm

    Stephen:
    I did successfully complete the install–I put in a fresh copy of the file, then it went without a hitch.

    New question: I now have 4 blogs set up. Kiskiblog.kiskipby.org will be the main blog. There will be 4 “sub” blogs: rwanda (rwanda.kiskipby.org), and Wayne, Erin and disasterteams with the same subdomain pattern.

    I thought I saw a multiblog install with a navbar across the top with links to the other blogs. Is there a way to activate this in the install which I’m not seeing, or do you know how to manage this?

    again, thanks for this product! I’m almost there.
    erin Cox-Holmes

  8. #288 | Posted August 27, 2008 at 2:49 pm

    Erin –

    Not automatically, though you could certainly hard-code the links into your theme.

    This is something I may support in future, but it’s not there yet. I’m currently working on code where the various blogs register themselves in the database; if I get that working, it could allow for such a system in the future — essentially a whole-blog equivalent of listing pages in your sidebar.

  9. #289 | Posted August 27, 2008 at 3:09 pm

    Stephen, if you get that working, it would be a welcome addition. The reason I need to go the multiple blog route is that we have lots of readers who are not familiar with blogs and cannot get the idea of categories in their heads.So I’m hoping to get this configured so they click a navbar similar to the page tabs in wordpress, but each tab evokes an actual blog, since the pages are static in WP.

  10. Bob Johnson
    #290 | Posted August 27, 2008 at 3:34 pm

    Hi Stephen, this sounds like a great thing. Is it know if this works with Godaddy’s multiple site hosting?

    I have WP 2.6 installed in the root of domain1.com. domain2.com has the dns for my Godaddy hosting and on Godaddy, I have set it up to point at the same root directory of domain1.com, where WP is installed. I did the advanced setup and put in the VUsers, yet domain2.com shows the domain1.com blog.

    Thanks for any help

  11. #291 | Posted August 27, 2008 at 4:19 pm

    Bob — I believe your setup is basically domain forwarding, which will not work.

    You would have to get GoDaddy to set up domain2, and they would have to point the “document root” to the same folder as domain1. Ask GoDaddy — they may be willing to do this, but they would consider it unusual (which it is!)

    [Updated: The ability to work with domain forwarding is another feature to be added. Basically I could do it right now, but as the system works it's a huge security risk. So some work is needed in the system to lock down security issues with domain forwarding]

  12. dndco
    #292 | Posted August 27, 2008 at 5:33 pm

    I am still in a trial and error cycle. I am thinking the problem is Plesk which I manage my VPS with.

    Has anyone gotten a domain1.com, domain2.com version working on Plesk?

    If so what was the procedure you followed?

    Thanks.

  13. Bob Johnson
    #293 | Posted August 27, 2008 at 5:33 pm

    Stephen, thanks for replying. Here is how it works when I host multiple domains without WP. My primary domain for the hosting account is domain1.com. It can be registered anywhere and it points to Godaddy’s dns. domain2.com is registered elsewhere also and points to the same dns. When I go into my hosting account for domain1.com, I add domain2.com and give it a path into another directory (non root) of the primary hosted domain, such as /d2. When I add my content it goes into domain1.com/d2 but when typing domain2.com into the browser, domain1.com/d2 is masked and everything looks like its all separate. If I had domain3.com, I would add a path /d3 for the root and put my content into domain1.com/d3. I don’t know if that helps or makes any difference with your product. Thanks again.

  14. #294 | Posted August 27, 2008 at 6:46 pm

    Bob –

    When I go into my hosting account for domain1.com, I add domain2.com and give it a path into another directory (non root) of the primary hosted domain, such as /d2

    NO. Point domain2 to the same root directory as domain1. Point domain3 to the same root directory as domain1.

    Get rid of the /d2 folder. It’ll just confuse things.

  15. Bob Johnson
    #295 | Posted August 27, 2008 at 9:32 pm

    Stephen,
    I did do as you say for your product. I was describing how Godaddy handles multiple domains on one hosting account for other things.

    When I set this up with your product, I pointed domain2.com at the root folder of domain1.com which is where I installed WP, like you say. When domain2.com is typed in a browser, it resolved back to domain1.com.

  16. #296 | Posted August 27, 2008 at 11:34 pm

    Bob — it’s time for some stupid questions:

    1) What, exactly, do you have in your $vusers[] list?

    2) What, exactly, did you name your config files?

    3) Did you put a different table-prefix in each config file? If using autocofig, you should not have any table prefix at all.

    Basically it sounds as though the system can’t properly determine VUSERs. If it can’t figure out what the right VUSER is, it falls back to the default — domain1.

  17. Bob Johnson
    #297 | Posted August 28, 2008 at 11:17 am

    In the mp-users.php file, I have:
    $vusers[] = ‘domain1.com’;
    $vusers[] = ‘domain2.com’;

    In wp-content/multiblog/config, I have:
    mb-autoconfig.php
    mb-config-sample.php (no changes made to this)
    mb-users.php

    Nothing done for table prefix, I am using autoconfig.

  18. #298 | Posted August 30, 2008 at 1:46 pm

    Stephen, YOU are my Personal Jesus.

    To everyone that’s asking how to implement “per-user” folders, that’s the trick I used:
    I followed the guide of Stephen making work perfectly 2-3 blogs.

    After that, I created a symbolic link in the “multi”-wordpress installation directory called “files”.
    The symbolic link links to “/home/”

    So in every blog-website, if I have galleries of pictures to use with nextgen-gallery, or sitemap.xml files to create with “Google XML Sitemaps”, I can use the public folder:
    http://www.whateverdomain.com/files/whateverdomain/site...
    or galleries/
    or wathever you need.

    That’s is wanderful also because I can jail the ftp users in their home directory and they will just see the galleries/xml files without seeing WordPress.

    That’s awesome, thank you again Stephen.
    I’ll donate some money for sure.

  19. #299 | Posted September 2, 2008 at 1:58 pm

    Hi :)

    Multiblog is really COOL!

    Still, there is a problem when using it with Windows Live Writer (and admit it, this program is really helpful when writing a blog :) ).

    When trying to get category list from a blog using Multiblog you get an error message, here are the log details.

    
    Parse error:  syntax error, unexpected ':' in /home/content/---/html/xmlrpc.php on line 2
    ",""
    WindowsLiveWriter,1.484,Fail,00049,02-Rgs-2008 21:30:01.420,"WindowsLive.Writer.Extensibility.BlogClient.BlogClientInvalidServerResponseException: Invalid Server Response - The response to the blogger.getUsersBlogs method received from the weblog server was invalid:
    
    Invalid response document returned from XmlRpc server
       at WindowsLive.Writer.BlogClient.BlogClientBase.CreateAuthenticatedCredential()
       at WindowsLive.Writer.BlogClient.BlogClientBase.Login()
       at WindowsLive.Writer.BlogClient.Clients.XmlRpcBlogClient.CreateCredentialsFilter(String requestUri)
       at WindowsLive.Writer.BlogClient.Clients.XmlRpcBlogClient.SendAuthenticatedHttpRequest(String requestUri, Int32 timeoutMs, HttpRequestFilter filter)
       at WindowsLive.Writer.BlogClient.Detection.BlogSettingsDetector.ExecuteHttpRequest(String requestUri, Int32 timeoutMs, HttpRequestFilter filter)
       at WindowsLive.Writer.BlogClient.Detection.LazyHomepageDownloader.get_HtmlDocument()","   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at WindowsLive.Writer.CoreServices.Diagnostics.LogFileTraceListener.Fail(String message)
       at System.Diagnostics.TraceInternal.Fail(String message)
       at System.Diagnostics.Trace.Fail(String message)
       at WindowsLive.Writer.BlogClient.Detection.LazyHomepageDownloader.get_HtmlDocument()
       at WindowsLive.Writer.BlogClient.Detection.WriterEditingManifest.ScanHomepageContentsForManifestLink(Uri homepageUri, LazyHomepageDownloader homepageDownloader)
       at WindowsLive.Writer.BlogClient.Detection.WriterEditingManifest.FromHomepage(LazyHomepageDownloader homepageDownloader, Uri homepageUri, IBlogClient blogClient, IBlogCredentialsAccessor credentials)
       at WindowsLive.Writer.BlogClient.Detection.BlogSettingsDetector.SafeDownloadEditingManifest()
       at WindowsLive.Writer.BlogClient.Detection.BlogSettingsDetector.DetectSettings(IProgressHost progressHost)
       at WindowsLive.Writer.PostEditor.ServiceUpdateChecker.Main()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()"
    WindowsLiveWriter,1.484,None,00050,02-Rgs-2008 21:30:02.207,"Exception parsing XML-RPC response:
    
    WindowsLive.Writer.CoreServices.XmlRpcClientInvalidResponseException: Invalid response document returned from XmlRpc server ---> System.Xml.XmlException: There are multiple root elements. Line 2, position 2.
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
       at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res)
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
       at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
       at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
       at System.Xml.XmlDocument.Load(XmlReader reader)
       at System.Xml.XmlDocument.LoadXml(String xml)
       at WindowsLive.Writer.CoreServices.XmlRpcMethodResponse..ctor(String responseText)
       --- End of inner exception stack trace ---
       at WindowsLive.Writer.CoreServices.XmlRpcMethodResponse..ctor(String responseText)
       at WindowsLive.Writer.CoreServices.XmlRpcClient.CallMethod(String methodName, XmlRpcValue[] parameters)

    Problem appeared only after installing Multiblog. Any suggestions? :)

  20. #300 | Posted September 2, 2008 at 3:19 pm

    I can’t imagine how VMB could cause this. Try reinstalling WordPress; maybe you have a corrupted file.

    I use TextMate for some of my blogging, which uses the same XmlRpc client interface.

    To my other readers:
    Has anyone else experiences this problem?

    Although…

    Invalid response document returned from XmlRpc server ---> System.Xml.XmlException: There are multiple root elements. Line 2, position 2.

    This might suggest that when you try to connect it’s finding multiple blogs with the same call…? I don’t really know why such a thing might happen, but maybe some conflict involving .htaccess. That’s just a stab in the dark — again, I’ve never had (nor heard of) any problem with XmlRpc. Try reinstalling the WordPress files first.

Pages: « 113 14 [15] 16 1720 » Show All

Post a Comment

Your email is never published nor shared.

Subscribe without commenting