Skip to main content

Clean URLs in Drupal Don't Work

On a recent upgrade of Drupal, I ran into the following error:

/drupal/admin/settings/clean-urls was not found on this server.

It turns out that the directory where Drupal was installed (/home/web/drupal-5.7) was missing it's .htaccess file. The contents should have been:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
 Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
    php_value magic_quotes_gpc                0
    php_value register_globals                0
    php_value session.auto_start              0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
    php_value magic_quotes_gpc                0
    php_value register_globals                0
    php_value session.auto_start              0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
    php_value magic_quotes_gpc                0
    php_value register_globals                0
    php_value session.auto_start              0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
    # Enable expirations.
    ExpiresActive On
    # Cache all files for 2 weeks after access (A).
    ExpiresDefault A1209600
    # Do not cache dynamically generated pages.
    ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
    RewriteEngine on

    # If your site can be accessed both with and without the prefix www. you
    # can use one of the following settings to force user to use only one option:
    #
    # If you want the site to be accessed WITH the www. only, adapt and
    # uncomment the following:
    # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    # RewriteRule .* http://www.example.com/ [L,R=301]
    #
    # If you want the site to be accessed only WITHOUT the www. prefix, adapt
    # and uncomment the following:
    # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
    # RewriteRule .* http://example.com/ [L,R=301]

    # Modify the RewriteBase if you are using Drupal in a subdirectory and
    # the rewrite rules are not working properly.
    #RewriteBase /drupal

    # Rewrite old-style URLs of the form 'node.php?id=x'.
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
    #RewriteRule node.php index.php?q=node/view/%1 [L]

    # Rewrite old-style URLs of the form 'module.php?mod=x'.
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
    #RewriteRule module.php index.php?q=%1 [L]

    # Rewrite current-style URLs of the form 'index.php?q=x'.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.81 2007/01/09 09:27:10 dries Exp $

This would have "fixed" the clean-URL issue I was having with Drupal. I know that many of the lines above are commented out. If I go back to Drupal I'll have to investigate why they were commented out.

Manually configuring a NIC

After adding a network card (NIC or Network Interface Card) to an OpenSuSE system, and configuring the device with YaST, I could not get it to activate. After a reboot it still didn’t show up as an active interface.

YaST did create an interface for it, along with all the configuration information (to include the static IP Address), but bringing up the interface (using ifup eth0) failed. (NOTE: If this is a second NIC, it would show up as eth1, a third NIC as eth2, etc.) The configuration information showed up in /etc/sysconfig/network/ifcfg-eth-bus-pci-0000:02:03.0. When I execute the command ifup eth0 it give me an error "No configuration found for eth0".

The simple solution is to rename the file /etc/sysconfig/network/ifcfg-eth-bus-pci-0000:02:03.0 to /etc/sysconfig/network/ifcfg-eth0. Then you can run the command ifup eth0 and it will work fine.

Note that the names of the device (bus-pci-0000:02:03.0) may be different on your system. If it is, just use YaST to determine which NIC it is (based upon the device assignment) and rename that device.

An alternative is to rename the device based upon it’s MAC address. So if the MAC address is 00:0C:29:31:0F:48 you could rename the deivce from ifcfg-eth-bus-pci-0000:02:03.0 to ifcfg-eth-id-00:0C:29:31:0F:48. Of course, this is in directory /etc/sysconfig/network/.

Additional information about configuring and debugging NICs under SuSE / SLES can be found at these web pages:

http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.3/suselinux-adminguide_en/sec.basicnet.manconf.html

http://openskills.info/infobox.php?ID=949

You can also search Novell OpenSuSE website for additional information .

Ubuntu Install on VMWare

On building a new system in VMware, frequently there are additional things you need to install. In addition to installing the VMware tools, there are certain dependencies that need to be added as well. These include make, gcc, and the kernel libraries. These can be done with the following commands:

# apt-get install make
# apt-get install linux-headers-2.6.22-14-server
# apt-get install gcc

You may need to ensure the media is mounted:

# mount /dev/cdrom

This of course assumes that the CDROM drive has presented the appropriate ISO.

I also need to install the ssh software so I can log into the system:

# apt-get install ssh

Followed by starting the service:

# /etc/init.d/ssh start

After all this was done, I needed to be able to install the VMware tools. So I unmounted the Ubuntu ISO to install the tools:

# umount /dev/cdrom

Disconnecting the CDROM and then clicking on the install VMware tools inside VMware.

# mount /dev/cdrom
# tar xzvf /media/cdrom/VMwareTools-6.0.2-59824.tar.gz
# cd vmware-tools-distrib/
# ./vmware-install.pl

Follow all the default prompts for the installation.

Drupal Node Access

On a recent upgrade from Drupal (information at http://www.drupal.org) v4.6.x to v5.1, I discovered that many of my "protected" pages were again publicly accessible. Since I'd already done the conversion on my production drupal instance, this was of some concern to me, but due to time constraints there was little I could do about it. Since my time was at a premium, I wasn't able to look at it until Thursday night (July 26th), after doing the conversion the prior weekend. That's when I discovered that the fix was actually fairly simple to implement.

The first thing I had to do was truncate the nodaccess table. PhpMyAdmin (which I have installed) does this easily, but you can also use native SQL to do the same thing. (The MYSQL command is: TRUNCATE TABLE nodeaccess;)

After doing that, I just had to log back into my site as a user with Administrative rights (full rights) and to Administrator -> User Management -> Node Access (i.e., /admin/user/nodeaccess URL) I was able to re-save my grants. This populated the nodeaccess table and my "protected" pages were once again unavailable to anonymous users.

Again, it was a relatlvely simple fix, but required some free time to fully research.

Change the Default Editor from Nano on Ubuntu Linux

Many of the utilities in Ubuntu Linux use a text editor to allow you to edit configuration options and files. An example of this is using the crontab command, which allows you to edit your cron jobs using the default editor.

It's really easy to set the default editor using the update-alternatives command. Open up a terminal window and type in the following command:

sudo update-alternatives --config editor

Here's an example of what you'll see:

$ sudo update-alternatives --config editor

There are 5 alternatives which provide 'editor'.
Selection Alternative
--------------------
1 /usr/bin/vim
2 /bin/ed
\*+ 3 /bin/nano
4 /usr/bin/vim.basic
5 /usr/bin/vim.tiny

Press enter to keep the default[*], or type selection number:

You can select the editor you want by just typing in the number. For example, if I want to change the default editor to vim, I would just hit the number 1.

You can test this out by typing in crontab -e to edit your cron file. You should see the editor that you chose, instead of the default.

Possible K3B Issue(s)

I recently ran into a problem where I was unable to successfully burn a DVD (Digital Video Disk) .ISO file. (NOTE: Some documentation may refer to a DVD as a Digital Versatile Disk instead of a Digital Video Disk. Both are correct. The term Digital Video Disk is more commonly used because it is the format for watching movies.) For those who may not be aware, an .ISO file is an image of a data CD (Compact Disk) or DVD.

At any point, multiple burns of the same image (.ISO) on different computers with different DVD writers all resulted in the same failure. Even though K3B reported the burn (creation of the new DVD) as successful, I was not able to use the DVD successfully in another system. I was able to verify the issue by using a program called md5sum that generates a unique identifier based upon the contents of the DVD (or files) it is checking. The MD5SUM (the number) for the original download did not match the number for the new DVD on any one of the 5 copies I created. In effect, these failures caused me to burn "coasters" (since that was all the DVDs were good for). Looking at some other websites, I was able to piece some information together. While the documentation is sporadic, and this error may be unique to creating DVDs, I found that using the following options in K3B allowed me to successfully. I added the options to the growisofs command: -use-the-force-luke=dao -dvd-compat Hopefully this will solve anyone elses issues. And as I get more information, I'll try to update this page.

Virtualization (Part 2)

Now that I have explained virtualization (see /posts/virtualization_part1), the question remains of why would anyone use it? The reasons for using virtualization at home include: Software Development (or creating new software), Software Testing (does it work on my system or how my computer is set up), Application Testing (if I make this change to some software, will it still work as I expect), and even Web Surfing. The reasons for using it at the office are the same, but also include Hardware Consolidation (replacing several servers with one larger system and then running the small servers in a virtual environment, saving power and maintenance costs).

A lot of people ask why you would surf the web from a virtual system. The answer is simply that if you download a virus or spyware, you can just rebuild (or roll-back to a previous version) of the virtual environment. This is especially easy if you use a version that runs directly from CD like Ubuntu/Kubuntu or Knoppix, among others. Running an operating system in a virtual environment allows you to quickly remove the virus / spyware or other malware installed on your system. It also ensures that your financial data (from Quicken or whatever application you use) is not “visible” on the Internet in case there is some way for your computer to be broken into. For those people who are security conscious, it only provides one more level of isolation to protect yourself while on-line.

Since I run anywhere from 6-10 computers in my “office” at home at any time, I use virtualization to test changes prior to making them on my “production” systems. It also allows me to test software changes prior to making them on my computers. It also gives me flexibility to test new versions (or even different versions) of Linux as I can install them into my “virtual” environment. If I'm not happy with how it looks or works, it is easy for me to delete the virtual environment without impacting my main systems.

As time allows, I'll explain some of the software I've used for virtualization, as well as some ways Below are links to more information about virtualization:

Virtualization (Part 1)

Everywhere you turn, IT professionals are talking about virtualization as the next big wave in technology. People banter around the terms Virtualization, Virtual PC, VMware, and others. But while IT people debate virtualizing computers, many people don't understand the concept, or why it's even needed.

To get an understanding of virtualization, computer users need a little understanding of whats going on in their computers while they're being used. Specifically, as computers have gotten faster and more powerful, users haven't been able to work as fast the computers can. This has allowed Windows to “multi-task” or do more than one thing at a time. Since the computer can't really do more than one thing at a time, it switches between tasks so quickly it appears to the user that the computer is doing more than one thing at a time.

While some things, like watching a DVD for instance, require more from the Central Processing Unit (CPU or brain of the computer), many things can run at the same time with no noticeable impact (or very little) from the user. This allows programs to “share” resources, like memory, CPU, the keyboard, and other hardware components. The software that provides virtualization is just another process in the system, and is able to share resources with other processes. This explains how virtualization works, but it doesn't explain what it is.

Virtualization is software (and sometimes part hardware in newer computers) takes some of the resources in the computer, and dedicates it for a specific purpose. This “splitting” of resources allows for a “virtual” computer system. From the “host” system, the system running the virtualization software, the resources are shared. But from inside this “client” system, the client system only “sees” the resources dedicated to it. As an example, if your computer has 512 Megabytes of computer memory, you can create a virtual system with 256 Megabytes of memory. Your computer sees all 512 Megabytes of memory, with a software programming dedicated to 256 Megabytes. However, the virtual “computer” sees it's own processor and 256 Megabytes of memory. And inside this virtual system, you can run a completely different operating system and it's applications.

MySQL Password

There are a variety of ways to change your MySQL password. One of the easiest is from the command line. You can use a command like:

mysqladmin -u root password yourrootsqlpassword

to change your password. The above command changes the password of the acount root to yourrootsqlpassword.

New Laptop Config

Well, I have finally bout a new laptop to replace my aging desktop PC. Why a laptop? I frequently support friends and family, so I wanted a system that I could take with me so I had all my tools handy.

I bought (from Costco) a HP DV6253CL (6200 series) laptop. It has the following configuration:

2 Gb RAM nVidia Video Card AMD Turion 64x2 Processor

I'm starting with a Debian (Etch) install. Unfortunately, it hasn't been formally released. On my first boot, the screen came up, but I couldn't see anything. I discovered by changing my kernel line from:

root (hd0,0) kernel /vmlinux-2.6.18-3-amd64 root=/dev/sda5 ro initrd /initrd.img-2.6.18-3-amd64 savedefault

to

root (hd0,0) kernel /vmlinux-2.6.18-3-amd64 root=/dev/sda5 ro noapic nolapic pci=routineirq initrd /initrd.img-2.6.18-3-amd64 savedefault

In fact, I added this as a new option (my first one so it booted automatically) to my grub menu

/boot/grub/menu.lst

After I compiled a new kernel, the lines became:

root (hd0,0) kernel /vmlinux-2.6.20.1-amd64 root=/dev/sda5 ro noapic nolapic pci=routineirq initrd /initrd.img-2.6.18-3-amd64 savedefault

I finally moved to Kubuntu, as only Kubuntu and OpenSuSE 10.3 Alpha 3 recognized my wireless card.