Drupal: An easy way to set up multiple sites on localhost

This works for a couple of subdomains/sites only. If you need to have a load of sites or other settings this is not for you. On the other hand this method needs no web server configuration.

  1. In your systems hosts file (Windows: In your favourite text editor open %SYSTEMROOT%\system32\drivers\etc\hosts and on Linux it’s /etc/hosts.
  2. Find the line defining 127.0.0.1, i.e. your local horst, erm localhost 🙂 and append sitename1.localhost to the end of the line. do so for every site name you need.
  3. Go to your apaches/webservers documents folder holding your drupal installation. Say it’s htdocs/drupal than you need folder sites. There should be at least two folders called all and default. Copy default and name it sitename1.localhost, i.e. excactly the string you added to your hosts file (again you need to replace sitename1 by your site’s name but do include the dot!).
  4. In your web browser type sitename1.localhost/drupal to test if drupal shows up at all (meaning your OS resolves your “domain name” correctly) and if it shows your old content (meaning it works).

Now you have two options to actually set up your “new site”: Either edit the settings.php that should be in the new folder to use a diferent data base (that should be well-stocked with drupal data) or just install a fresh drupal site. You achieve the later by doing:

  1. Delete settings.php. That should leave you with a file named default.settings.php.
  2. Point your browser to sitename1.localhost/drupal/install.php and do everything like you did with the first install but use a diferent database (or the same but different database prefix).
  3. Done.

Resources

  • settings.php

Furthur reading

Joomla 1.5: Using my own favicon via template?!?

Well, there am I trying to convince joomla 1.5 to use my template’s favicon instead of the default jommla flower Original favicon of Joomla a.k.a. The Flower. But no matter what it wouldn’t let me replace it by my own. What I’ve done so far:

  • create the .ico file with Gimp, 32×32 (tried 16×16 also), 4 bpp 16-slot palette
  • placed it in ../templates/my_template/favicon.ico
  • reloaded page in browser

But still no favicon is shown in neither Opera nor Firefox under Windows.

Update: It seams I somehow used wrong colour palette, layer or whatever optioins. After I uploaded a png file to FavIcon and used the result it at least shows in Firefox. Opera seams to chuck up on the HTML header created by Joomla:


<head>
  [...]
 <title>Welcome to the Frontpage</title>

  [...]
  <link href="/joomla/templates/div_template/favicon.ico" rel="shortcut icon" type="image/x-icon" />
  [... repeated multiple times somehow ...]
  <link rel="stylesheet" href="http://localhost/joomla/templates/div_template/css/template_css.css" type="text/css"/>
  <link rel="shortcut icon" href="http://localhost/joomla/images/favicon.ico" />
  <link href="/joomla/css/template.css" rel="stylesheet" type="text/css" />
</head>

As far as my understanding goes Opera doesn’t mistaken as to overwrite the earlier favicon.ico link with the later and hence (as Opera does) show the correct, i.e. intended favicon for a glimpse of a second and than show none as the /joomla/images/ one is not there. If I place a copy in that directory on the server Opera also shows the icon — I asume the wrong one though!

Well, anyway, now I know where the rub is…

Update 2008/05/08: I should have digged into templating a bit further and not just take it “as is”. Now in the html header of .../templates/my_template/index.php I just leave out the line where it points to the joomla template but rather only have one “shortcut icon” href as below:

<head>
	<jdoc:include type="head" />

	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />

	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/layout.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/typography.css" type="text/css" />
	<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/browserhacks.css" type="text/css" />
	<link rel="shortcut icon" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/icon/favicon.ico" />
</head>

Installing TYPO3 Version 4 on Debian

Just a quick walk through the steps necessary to get typo3 up and running. I had serendipity running for some time on apache2.2 with php5. So that worked prior to installing typo3. Than do

  1. sudo aptitude install typo3 php5-curl unrtf (php5-curl and unrft are only suggestions I splashed out on)
  2. zless /usr/share/doc/typo3/README.Debian.gz which lists what else to do
  3. sudo ln -s /etc/typo3-dummy/apache.conf /etc/apache2/sites-available/typo3 to make the typo3 directory (and underlying php stuff) available to apache2
  4. sudo rm -f /etc/apache2/conf.d/typo3-dummy.conf which is placed here by the debian package (maybe it is better placed here because it’s not really a site but some basic server config… I’ll delete it anyway)
  5. sudo a2ensite typo3 to enable the “site”. Bear in mind that this config grants access from anywhere (Order allow,deny \ Allow from all)
  6. sudo /etc/init.d/apache2 reload or alternatively do apache2ctl restart which, as the command suggests, restarts the whole server.
  7. Since PHP save mode is used the file and directory permissions on file system level have to be set to WWWUSER/WWWGROUP (www-data/www-data) for /var/lib/typo3-dummy. It’s done by the package allready.
  8. Log in to phpmyadmin and create a table (search for “Create new database”) named “typo3-dummy” (don’t use “typo3-dummy” unless you can enter the escape sequence "\`" for characters like “-“). An alternative method is to use the command line mysqladmin -u root -p create typo3dummy (see the typo3 wiki and mysql manual)
  9. Use the command line mysql -u root -p typo3dummy to log in to the new database (note the command is not mysqladmin) and grant permissions with mysql> GRANT ALL ON typo3dummy.* TO '<username>'@'localhost' IDENTIFIED BY '<password>';
    where everything in <> has to be individually replaced (without the <>).
  10. Now the hot stuff begins: Point the browser at http://servername/typo3/ which will start the 1-2-3 install tool. Login with your root user and password for mysql server and follow the steps. That’s it, folks! Enjoy.

Looking for a quick starter, some test page to try out typo3 on? Have a look at a german tutorial by Dawn or go directly to the suggested url to download the .t3d and instructions. Another place to go and grab some it the YAML for typo3 page. One might need to increase the memory size available to php via the apache config file /etc/php5/apache2/php.ini and search for memory_limit. Don’t forget to reload the apache2 configs afterwards.