Drupal Zombie

Dezombifying Drupal developers since 2011

    Braaains!
Eat braaains!
News feed

Install Drupal 7 on a shared host

Submitted by Kieran on

There are three tasks:

  1. Put the Drupal files on your server.
  2. Create a database for Drupal to use.
  3. Check the PHP register_globals setting on your server.
  4. Run the Drupal installation program, and tell Drupal about the database.

1. Put the Drupal files on your server

At the end of this task, all of the files that Drupal needs will be in a directory on your server. That directory will be accessible over the Web, at a URL you know.

Here are the steps in this task:

  • Prepare a place on your server for the Drupal files.
  • Download the latest version of Drupal from Drupal.Org, to your computer.
  • Upload the files to the server, in the place you prepared.

1.a. Prepare a place on your server for the Drupal files

You need to put the Drupal files in a directory on your Web server. The directory should be one that Web browsers can get to.

When you buy hosting, your hosting company will create a directory for you, called your home directory. Usually, the files in your home directory are not accessible over the Web. This lets you keep private files on your server.

The hosting company will create a directory inside your home directory, usually called public_html. This directory is available to the Web. It is the root of your Web site.

Suppose your domain is drupalzombie.com. This maps to the directory public_html on your account. You create a file called cow.html, and put it in public_html. So the path to the file is public_html/cow.html. The URL of the file http://drupalzombie.com/cow.html. Why? Because, in a sense, drupalzombie.com points to your public_html.

Suppose you create a directory in public_html, called emu. Then you create a directory in emu called wombat. You put the file eel.html inside wombat. So the file pathon your server is public_html/emu/wombat/eel.html. The URL would be http://drupalzombie.com/emu/wombat/eel.html.

If you want your site to be one single Drupal installation, then you don't need to do anything. public_html is ready. Just put your Drupal files there.

Let's not do that. Let's create a subdomain. This will make it easy to have several Drupal installations on the same account. It's also good for testing things out.

A subdomain is like yellow.drupalzombie.com. There's an extra name on the front of the URL. The name typically maps to a subdirectory like public_html/yellow.

Tell your server to create a subdomain, using your Web control panel. Here's how to create a subdomain in cPanel:

Making a subdomain

So, any files you upload into public_html/yellow will be accessible at http://yellow.drupalzombie.com.

1.b. Download the Drupal files to your computer

Here's what I see at http://drupal.org/download:

Download button

The big green button tells me that the latest stable release of Drupal is 7.10. Get whatever version the green button tells you to.

I click the green button, and see:

Versions

Drupal has hundreds of files. They are compressed into a single archive, to make downloading easier. Two archive formats are offered: tar.gz, and zip. I usually use the zip one; it's easier to work with on my Windows PC. I click the zip link, and that downloads the file drupal-7.10.zip to my computer.

Now I have the Drupal archive on my computer. I extract all the files from the archive. Here's how, in Windows 7:

Extract

Extract all... creates a directory called drupal-7.10. Inside that is another directory called drupal-7.10. Inside that are the Drupal files:

Nested directories

This directory nesting is a common source of errors for beginners. We'll see why in a moment.

1.c. Upload the files to the server, in the place you prepared.

Remember that I created the directory public_html/yellow. That's where the Drupal files go.

Start up favorite FTP client. Connect to your Web server, and navigate to the directory where your Drupal files will go.

Here's what I see:

Unneeded cgi-bin

mathieso is my user name, give to me by my hosting company. Your user name will be different. My home directory is /home/mathieso. /home/mathieso/public_html/yellow is the root of the subdomain yellow.drupalzombie.com. I created that earlier.

cgi-bin is not needed for Drupal. Delete it.

Now, in your FTP client, navigate to the files on your computer that you want to upload. This is where the nested directories cause trouble. You might have a screen like this:

About to mess up

It would be a mistake to drag drupal-7.10 into public_html/yellow. That would mean that the Drupal files would actually be in public_html/yellow/drupal-7.10 on the server. That's not what you want. You want the Drupal files in public_html/yellow. Open drupal-7.10 on your computer, so you get a screen like this:

Right!

Now drag all of the files to your server directory (hint: Ctrl+A often means "select all files"). You should end up with:

Files uploaded

If you've done this right, you should have a file with the path public_html/yellow/index.php.

2. Create a database for Drupal to use

Drupal stores most of a site's content in a database. You need to create an empty database for Drupal to use.

I'm going to show you how to do it with cPanel. YMMV.

There are three steps:

  • Create an empty database.
  • Create a user account for the database.
  • Give the user access to the database.

2.a. Create an empty database

On the cPanel home page, do this:

Database tasks

Now:

Creating a database

You'll see:

Database created

Notice the name of the database. You typed "yellow" (or whatever). But the name of the database is [your user name]_yellow. Why? Because other users may also have typed "yellow" into the database name field. How would the server know which one was which?

User names are unique. So adding the user name into the name of the database ensures that the server can tell the difference between your yellow database and everyone else's yellow database.

Record the name of the database. You'll need to tell Drupal about it later.

BTW, the database name need not be the same as the subdomain.

2.b. Create a user for the database

You need to create a new MySQL user account, and give it access to the database. MySQL user accounts have nothing to do with user accounts on your computer or server. MySQL user accounts are just used for MySQL.

On the same page where you created the database:

Create user

The user doesn't have to have the same name as the database. You can make up your own password, or have one generated for you.

Click Create User, and see:

Created a user

Record this information. You'll need to tell Drupal about it later.

2.c. Give the user access to the database

On the same page where you created the user, find the Add User to Database section. Select the database and the user:

Give user access

Click Add, and cPanel will ask you what privileges you want to to give the user. Grant them all:

All privilages

Click Make Changes. You'll see:

Added

So far, you've:

  • Uploaded the Drupal files to your server
  • Created a database for Drupal to use

3. Check the PHP register_globals setting on your server

Drupal is written in the programming language PHP. Early in PHP's history, a setting was added that seemed like a good idea at the time, but turned out to be a security problem. You need to make sure that setting is turned off, or Drupal will complain. The setting is called register_globals.

Go to your cPanel home page. Find the Software/Services section, and click on php.ini QuickConfig:

Software/services

(If cPanel tells you that PHP QuickConfig is disabled, click the button cPanel gives you to enabled it.)

Find the register_globals setting, and turn it off:

Register globals off

Save the changes.

4. Run the Drupal installation program, and tell Drupal about the database

Almost done!

Point your browser at the root of your new Web site, e. g., http://yellow.drupalzombie.com. The Drupal install program will run. Choose the standard installation profile.

Standard installation profile

This will set up Drupal with the most common options. If you choose Minimal, you'll have more work to do.

Choose a language:

Choose language

English is the default, but your can install dozens of other languages.

Tell Drupal about the database you created for it, using the information you saved earlier:

Database

Drupal will activate a bunch of modules:

Installing

Then you'll fill in the site information form:

Site information

The SITE MAINTENANCE ACCOUNT is your super-admin-user-can-do-anything account. Don't forget the username or password. Or you won't be able to do much with your site. Click Save and continue.

Congratulations!

You have a Drupal installation. Have fun!

Add a comment

Basic WYSIWYG

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <blockquote> <br> <cite> <code> <dd> <div> <dl> <dt> <em> <h2> <h3> <h4> <h5> <img> <li> <ol> <p> <pre> <span> <strong> <ul>
    Allowed Style properties: border, border-style, border-width, float, height, margin, margin-left, text-align, width

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Images
Images for your comment.
Files must be less than 1 MB.
Allowed file types: png gif jpg jpeg.
CAPTCHA
Prove that your are sentient. Code has letters only.
Image CAPTCHA
Enter the characters shown in the image.