Install Drupal 4.6 using cPanel
Many hosting providers use a control panel to shield users from the complexity of their servers. cPanel is one of those control panels. This small guide explains how to setup Drupal with CPanel.
Not everything in this guide may be applicable to your situation, because some hosting providers limit the options available to their users.
The basic assumptions: you have a domain name (http://www.example.com) and want to install Drupal at the document root, (usually public_html or htdocs), where it is reachable via the URL http://example.com or http://www.example.com. In order to accomplish this, the Drupal files such as .htaccess and index.php have to be placed into your server's document root, along with the Drupal subdirectories such as includes, modules, themes, etc.
Note that other files present may be overwritten. Make backups before installing Drupal and remove files that may interfere with installation (e.g. index.php or .htaccess). If the pre-existing .htaccess file is necessary for other parts of your site, merge it with the one provided with Drupal.
Upload the Drupal files and folders
The first step is to download the drupal distritbution archive "drupal-x.x.x.tar.gz" onto your local computer, and then unpack it using a program such as 7zip, WinZip, WinRAR or tar.
The second step is to upload the drupal files to your server. There are three options for uploading the files, two that use cPanel's built-in File Manager, and one that uses an FTP-client. The latter depends on FTP access provided by your host.
- FTP (easiest) - After unpacking the drupal archive on your local computer, upload the files and folders in the resulting drupal-x.x.x directory to the document root of your webspace.
- cPanels built-in File Manager, option 1 - After unpacking the drupal archive on your local computer, recompress the files and folders in the resulting drupal-x.x.x directory into a zip file or into a new tar file. The result should be that the top-level directory "drupal-x.x.x" is no longer present in this archive. Upload this new archive to the document root on the server and extract its contents. The Drupal files and folders should now be located in the document root.
- cPanels built-in File Manager, option 2 - Upload the entire drupal distribution archive "drupal-x.x.x.tar.gz" to the document root of the server and extract its contents. Then use File Manager to move all the files and folders in the resulting drupal-x.x.x directory to the the server's document root.
Because you need some files from the drupal archive in a later stage, it's a good idea to decompress it locally anyway.
Create a database
This step may not be necessary; some hosting firms provide only one pre-made database.
Before you proceed you should know:
- "username" - the username for connecting to the database
- "password" - the password for that username
- "databasename" - the name of the database
- Open cPanel
- Go to Server » MySQL Databases
- Choose a databasename* for the new database and press "Add Database"
- Choose a username* and password for the new database user and press "Add User"
- Grant permissions to the user; select the username and database name, check 'ALL' and press 'Grant permissions'
*Note: cPanel usually adds the cPanel username as a prefix to the newly created names.
Create database layout
- Open phpmyadmin (Server » PhpMyadmin)
- Select the newly created database
- Depending on the phpmyadmin version select the tab SQL or import
- Choose the file
database/database.mysqland press 'Go' - Alternatively copy-paste the contents of
database/database.mysqlin the query textfield and press 'Go'
Connecting Drupal
The default configuration file can be found in sites/default/settings.php. Before you can run Drupal you have to set the database URL and the base URL to the website.
$db_url = 'mysql://username:password@localhost/databasename';Set the $base_url to match your websites URL:
$base_url = 'http://www.example.com';See INSTALL.txt for more information.
Modify settings.php locally, then upload the modified file. Alternatively use cPanels text-editor to change the file on the server. Make sure to delete all trailing whitespace from settings.php when using the latter option or you will encounter the infamous 'headers already sent' warnings.
Create the first account
Point your webbrowser to your site (http://www.example.com/) and follow the instructions on the welcome screen.
Cron tasks
Many Drupal modules (such as the search functionality) have periodic tasks that must be triggered by a cron job. To activate these tasks, call the cron page by visiting http://www.example.com/cron.php -- this will pass control to the modules and the modules will decide if and what they must do. To call cron.php periodically you need to setup a cron job.
cPanel offers a way to set cronjobs via Server » Cron jobs. Carefully read the instructions on the screen; they may differ from the following example.
To run cron.php every day set the Minute and Hour fields to 0 and the rest of the fields to *. The command to run is:
GET http://www.example.com/cron.php > /dev/null