Running multiple sites on a local PC (localhost) from a single codebase, using Windows

Here's how to get mutltiple sites working on localhost using Windows XP. NB: This post was originally written for Drupal 4.6.x but has been updated for 6.x so some of the comments below are now obsolete.

Preparation

This page assumes that you have PHP, Apache, MySQL and Drupal all installed and working and have a MySQL admin tool available; the free community edition of SQLyog will do nicely, or you can use phpMyAdmin if you prefer. Again, I'll assume you've got one of these installed and connected to your database server. I'll use SQLyog here.

If you don't yet have PHP, Apache and MySQL installed then XAMPP will help! See also http://drupal.org/node/161975

Finally, I'll assume you're starting with a working D6.x installation, have followed the installation instructions and got the default site up and running. If not, start here http://drupal.org/getting-started/install.

Using Apache .htaccess files to stop proxies from caching pages

There are a number of situations that might result in visitors accessing a Drupal site via a caching web proxy. Even though such caches are typically a good thing for sites, sometimes these caching schemes can have undesirable side effects and you may find that instructing proxy servers not to cache pages is the only solution to some problems. (You can learn more about web caches and how they work.)

Some problems that caches may cause with Drupal sites include:

  • A change that a user made to a page may not be reflected immediately, forcing the user to wait some time to see content they contributed (such as a comment) appear on the site.
  • User identities become confused. A user may login under their username but when they access another page, the proxy server sends the cached page from another user's session, effectively switching the identities of the user.

Modules page is blank, says "page not found" or returns an error message

If you attempt to load admin/build/modules and get a blank page, a message that says "The requested page could not be found" or a server error, this is most likely a memory issue.

When viewing this page, modules are (since Drupal 5.x) only loaded if they are enabled (previously, even disabled modules were loaded). Even so, a fair amount of ancillary processing takes place on this page and can cause PHP to run out of available memory. Note that all modules' .info files are loaded whether or not the modules are enabled.

There are two fixes:

  1. Increase PHP's memory limit, e.g. to set it to 16MB try one of these:
    • memory_limit = 16M to your system's main php.ini file (recommended, if you have access. In case you don't, you can try to upload your own php.ini file in the root folder of your Drupal installation, but bear in mind that this will only have an effect if PHP is running as CGI)
    • ini_set('memory_limit', '16M'); in your sites/default/settings.php file (this doesn't work on all servers)
    • php_value memory_limit 16M in your .htaccess file in the Drupal root (this only works if PHP is running as an Apache module)

Taxonomy Browser: build a custom category view

Project page: http://drupal.org/project/taxonomy_browser

Think of this as a 'build your own category view' page.

When the end-user chooses the "Category browser" menu item, he/she is presented with a single page with each term organized nicely by vocabulary. The user selects the terms which she or he wants to see, and then this module constructs a proper URL (e.g. taxonomy/term/3,4,5) and then displays matching nodes to the user.

Taxonomy Access Control: Restrict user roles to access specific categories only

Taxonomy Access Control (a.k.a. TAC) allows the user administrator to control access to nodes indirectly, by controlling which roles can access which categories. The administration page is at User management > Taxonomy Access Permissions (in Drupal 6, admin/user/taxonomy_access; in Drupal 7, admin/config/people/taxonomy_access).

Permissions can be set differently for each user role. Be aware that setting Taxonomy Access permissions works only within one user role and within the module. (For users with multiple user roles, see section Good to know below.)

Note: If you are not familiar with how Drupal's node access system works, see these resources:

On this page

  1. Grant types
  2. Permission options
  3. Global and vocabulary defaults
  4. Good to know

Pages

Subscribe with RSS Subscribe to RSS - Drupal 6.x