Drupal

From DreamHost
Jump to: navigation, search
Box drupal.png

Drupal is a full Content Management System (or CMS) that can be deployed with any number of purposes. It has been developed as an open-source project and released under the highly open GPL license. As such it is free both as in beer and as in speech. Drupal prides itself on being a system wherein the openness allows any developer to easily add what she needs using modules, effectively creating an infinite platform for expansion and growth. It is written in the PHP scripting language.

Drupal Content Management System

Drupal adoption advice

Drupal is a highly flexible and powerful tool, and as such should be used by those with knowledge of HTML, web applications and at least a vague notion of how databases (such as MySQL) function. (As usual you don't have to actually know PHP and SQL to make it function, but a working knowledge of phpMyAdmin, the web-based MySQL administration tool, is helpful, if not mandatory, for using Drupal.)

If your goal is simply to maintain a blog (or weblog, something Drupal is quite capable of), you might consider using a simpler and more targeted application like WordPress, which will be less confusing and more stable due to its simplicity.

Standard Drupal Features (as of 4.7.x)

Drupal is highly modular; most of Drupal's user-visible features are written separately from the codebase. This section lists the functionality provided by the modules included in the latest Drupal release by default. The features provided by your Drupal system can easily be expanded by adding or writing other modules.

  • Users (scalable user structure)
  • Forums
  • Blogs (per user or collective)
  • Articles
  • Static pages
  • Collective Book Writing.
  • Taxonomy (categories)
  • File-attachment on posts.
  • International interface translations.
  • Multi-language support.

Installation

Drupal 7

Drupal 7.x is easy to install on DreamHost. The steps to follow are:

  1. Copy the current Drupal 7.x files to your DreamHost website root
  2. Create your MySQL database for Drupal
    1. Go to your DreamHost MySQL panel and create it (database name + hostname)
    2. You might have to wait up to over 30 minutes, the time the newly created hostname propagates and is recognized by the Drupal installer
  3. Go to your website to start the Drupal 7.x installation
    1. The installation steps are simple to follow
    2. Note that in 'Advanced options' (hidden by default), you must change the default "localhost" to the full MySQL hostname (eg mysql.mywebsite.com)
  4. Configure Drupal and install third-party modules
    1. It is recommended that you either deactivate account creation requests (in /admin/config/people/accounts) or install a spam-reducing module such as Mollom in order to stop spam user accounts right away
    2. This is what requires more time and experience

WARNING: If you are installing Drupal 7 with multiple modules, you may trigger an error message stating that the installation cannot find a needed table in the MySQL database. This usually means that the Drupal installation of the MySQL database on DreamHost has not finished populating the full list of tables with data. Go for a walk, read a newspaper, or meditate. Try the installation again. The length of time is dependent on the number of modules you have selected to install. If you are installing a fresh version of Drupal 7, you may have better results if you first install the slimmer version when the installation asks. You can always add more modules later.

NOTE: If you are migrating a site created at Acquia's Drupal Gardens free development service, take heart, it works. Be aware, however, that the exported Drupal 7 website from Acquia is feature-rich and very nifty, but the price you pay is that the installation on DreamHost will most likely trigger the "Table Not Found" error; and you may be unhappy with the page display times if you are using a basic shared hosting plan here on DreamHost. Drupal 6 generally runs quite well on DreamHost with a basic shared hosting plan. Drupal 7 demands more resources, especially from the MySQL database. If you want to use Drupal 7 you should seriously consider upgrading to a virtual MySQL server on DreamHost, which displays pages much more quickly. For an example, visit this testing website under construction hosted here on DreamHost using the virtual MySQL server plan.

Drupal 6

As of February 2012 Drupal is in version 6.25. This is the easiest version of Drupal ever. It includes a screencast for installation. Directions for upgrading from version 5 to version 6 also include a detailed screencast.

Drupal 6 Manual Installation

Detailed instructions for installing earlier versions specific to DreamHost are below. You can either install version 6 directly, or install an earlier version and then upgrade to the latest version.

WARNING: You may get the following error during installation: "Failed to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)." First, try the following: click the Advanced tab and change the server from its default "LOCAL" to the actual mySQL user hostname, such as example.example.com. If that doesn't resolve your problem, chill out and come back to it a short time later. It may simply be that the server is overtaxed at the time and will function properly when the heavy use period has subsided.

It may also be that, if you have just created the hostname that you are using from withing the DreamHost web panel, the DNS settings for that hostname have not yet been updated across the internet and that hostname is just not available yet. You can easily test whether or not this is the case by browsing directly to the hostname (http://mysql.example.com, etc.) to see if that host if reachable. If it is reachable, you will be presented with an apache authentication dialog box; if it is not, you will get an error. If you cannot browse to the host directly, just wait until you can do so before proceeding.

Migrating out of Easy Mode

If you set up a site using DreamHost's Easy-Mode drupal multi site and want to move it to an installation of your own (perhaps because you want more control over themes or modules), you can simply delete the installation, and that will cause your existing Drupal Easy-Mode database to appear in your "Goodies → Manage MySQL section of the account control panel. This way you can migrate content, configuration and user accounts.

Older Unsupported Versions

For instructions on installing older Drupal version, which are unsupported and not recommended, see this old documentation.


Drupal Cron Jobs

This is something that many novice Drupal users (in fact many novice website designers/developers) have trouble with. It's a good idea to check out the Crontab page here on the wiki as a start, but here is some basic info you need to get the various Drupal Cron-Dependent stuff up and running (such as the search function).

Additional instructions are found on the Configuring cron jobs on DreamHost page on Drupal.org.

Using the Web Panel

Cron jobs can be set up directly through your DreamHost control panel here.

The command to be entered is:

curl --silent --compressed http://example.com/cron.php

Note for Drupal 7 installs: Make sure to use a cron.php URL that includes your "cron key", a query string variable provided by Drupal. The unique URL to the cron script including the cron key can be found on the Status Report page, under the Cron heading.

Using a Shell

  • 1. Create a text file (name it crons.txt) with your cron job on the first line, it should read something like this:
0 2 * * * /usr/bin/wget -q --delete-after http://www.yourdomain.com/cron.php
Make sure that there is a line break at the end of your cron job, this lets it know that the job is over! Save the file as a text file.
Specifically this tells the server to run "wget" every day at 2:00 am. The address at the end, tells it specifically to visit the cron.php file, which is where Drupal stores any cron job stuff (such as search indexing). You can read more about Crontab here on the wiki, especially if you would to change it to run weekly, rather then daily, or have run it at a different time.
Note for Drupal 7 installs: Make sure to use a cron.php URL that includes your "cron key", a query string variable provided by Drupal. The unique URL to the cron script including the cron key can be found on the Status Report page, under the Cron heading.
  • 2. Upload your text file to yourdomain.com/ via your FTP Program. It must be uploaded via ASCII mode, this should be automatic for most FTP Clients, but just double check to make sure!
  • 3. Login to your account via SSH. Make sure that you have the permission to do so, via DreamHost's Control Panel under the "Manage Users" section.
Two authors here suggests PuTTY or for Window Users for SSH'ing.
  • 4. Type in:
crontab yourdomain.com/crons.txt

Alternately, check to see if you are in your home directory by typing "pwd". If you see /home/yourUserName then you are in your home directory. Type in:

crontab ./crons.txt
Make sure your using the correct domain/folder for your site where crons.txt is located.
  • 5. If all went well type in the following:
crontab -l
If you see your cron job on its own line, then your done! Your Drupal Cron Job is now setup!

To "force" a cron job event for Drupal (such as on a brand new Drupal site), you can actually browse to the file manually via SSH using the following:

wget http://www.yourdomain.com/cron.php

If all goes well, then you won't see anything except for the file's name and some other information, but if you check your Drupal's Search Settings, it should show an increase in the amount of your site that has been indexed.

Removing Drupal from your Domain

To remove a Drupal installation from your domain, just delete all your Drupal related directories and files from your domain's space and, optionally, delete the database in the Control Panel. DreamHost does not completely empty your directories even if your remove the hosting option. Should you later re-add the domain's hosting, any files yo had left in the directory could still be present.

A database created on DreamHost is never fully dropped using the Control Panel → Goodies → Manage MySQL screen. If you login to the host with the appropriate credentials, via phpMyAdmin or the shell command line, you'll still find your database. DreamHost does not completely delete the database as the result of a Control Panel action. Be careful!

If you no longer want a database you have set up on DreamHost, and you have any sensitive data in the database that you want to obliterate, you might consider dropping all the tables from the database so that the data can not be viewed in this manner.

See also

External Links

  • Drupal - Drupal's Main site.
  • Download - Download page for Latest version of Drupal
  • Handbook - Drupal's Official Handbook (not perfect)
  • Forum - Drupal's forum, search before asking a question!
  • Videos - Bittorrents for some videos of presentations at a Drupal Conference.
  • Podcasts - Podcasts (video and audio) by Drupal developers Lullabot.
  • Themes - Some preset themes that can easily be used in your Drupal installation.
  • Building Online Communities With Drupal, phpBB, and Wordpress - Apress book showing users how to effectively configure and use all three applications
  • Intro to Drupal - Intro to Drupal - An audio podcast by happy DreamHost client CreativeXpert. A great place to start.
  • Drupal for Beginners - Overview of Drupal for noobs: module recommendations, links to key resources, more. (Hosted on DH, too!)