How to Install Drupal 7 Locally (using XAMPP)

How to Install Drupal 7 Locally using XAMPPIn this step-by-step tutorial, you will learn how to install drupal locally (on localhost / your computer) using XAMPP program.

In this tutorial, I use XAMPP 1.8.0, Drupal 7.15, and Windows 7; But, it doesn't mean you are limited to those. This tutorial probably woks great for any Windows (XP, Vista, Seven, and 8), any Drupal 7.x version, and any XAMPP 1.8.x.

Here are the steps to install Drupal locally using XAMPP software:

1. Install XAMPP Program

To install Drupal, we need a Server, a Database, and a Programming language. Fortunately, XAMPP installs all of those for us, we only need to install XAMPP.

XAMPP will install Apache (Server), MySQL (Database), PHP (Programming language), Perl (another programming language). In addition ot those, XAMPP installs other useful programs such as phpMyAdmin (which is a great program to manage Databases).

a Point: XAMPP stands for Apache, MySQL, PHP, Perl. And X represents the operating system XAMPP is supposed to be installed on, which includes Windows, Mac OS, Linux, and Solaris. Previuosly there were separate versions for Windows, Linux, etc. so, those were named WAMPP (for Windows only), LAMPP (for Linux only), etc. Now it is just XAMPP, and it has different distributions : XAMPP for Windows, XAMPP for Mac OS, XAMPP for Linux, and XAMPP for Solaris.

O.K. enough of extra information!

1.1. Download XAMPP

Go to XAMPP project page and choose the XAMPP distribution you need - based on the OS you are going to install XAMPP on.

Here we use XAMPP for Windows distribution. Download the "Installer" (about 90 MB).

1.2. XAMPP Installation

Run the exe file you just downloaded.

Choose English Language.

If a window pop-uped, click OK.

You should now see the XAMPP Setup window:

XAMPP Setup Window

Press "Next" button.

In next window, you should choose the destination folder for XAMPP to be installed on. Leave it as it is (c:\xampp), of if you like to change it, I suggest you only change the drive (e.g. d:\xampp) and not to change the destination to something like C:\Program Files\xampp. Press "Next".

Do not change anything in the next window:

XAMPP Options

Press "Install" for XAMPP installation to begin. It takes some time...

No need to do anything untill the "Finish" button appears. Press "Finish". A message pop-ups asking you whether open the XAMPP Control Panel or not, press "Yes". If you pressed "No", you can always open XAMPP control panel using the shortcut on your desktop.

In XAMPP Control Panel window: Press "Start" buttons in front of Apache and MySQL modules, to enable them.

XAMPP Control Panel

Congratulations! Your Local Host is ready. You can now put any site in the htdocs folder (in xampp folder) and access it from http://localhost. For example, you can put index.php in c:\xampp\htdocs\drupalkar and access it on your browser from http://localhost/drupalkar/index.php.

Enter http://localhost on your browser. XAMPP page opens. Press English to enter XAMPP for Windows page. In this page, you can find different information about your local host, for example, press phpinfo() to view informatin about the PHP installed on your local server.

 

2. Install Drupal on XAMPP

Now that our local host is ready, it's the time to install Drupal:

Make sure Apache and MySQL modules are started, like mentioned in previous step.

2.1. Download Drupal

Download the latest Drupal version from Drupal project page on Drupal.org.

2.2. Create a Database

Before installing Drupal, we need to create a database for it:

Open XAMPP Control Panel. Press the "Admin" button in front of MySQL. This will take you to http://localhost/phpmyadmin which opens phpMyAdmin.

Go to "Databases" tab of phpMyAdmin. Below the "Create database" label, enter a name for the database you are going to create (enter "drupal7").

Create Database for Drupal using phpMyAdmin

Press "Create". The database will be created and its name will appear on the left column of the page.

2.3. Time to Install Drupal!

Extract the compressed Drupal file you downloaded later to htdocs folder, and rename it to drupal7. The folder will be like C:\xampp\htdocs\drupal7

Now, open  http://localhost/drupal7  URL in your browser to go through Drupal installation process.

Drupal Installation - Select Profile

As you can see in the left column, you should pass 7 steps to install Drupal:

Step 1: Choose Profile

Choose "Standard" profile and press "Save and continue".

Step 2: Choose Language

If you like, you can read the instructions to install a language other than English and continue installation using that language. Here we continue with English. Go to next step.

Step 3: Verify Requirements

In this step Drupal checks to make sure your host has all of the requirements for Drupal to be installed with no problem.

If everythig is OK, you will directly go to step 4:

Step 4: Database Configuration

Now we should enter the database info.

Leave "Database type" as it is, because our database type is MySQL.

For "Database name" enter the database name you chose on step 2.2 (we chose "drupal7").

For "Database username" enter "root".

Leave "Database password" empty.

Database Configuration for Installing Drupal Locally

Press "Save and continue"

Step 5: Install Profile

Drupal goes into installation process... After Drupal installed, you will be automatically redirected to step 6:

Step 6: Site Configuration

Enter the site information:

Choose a name for your Site.

Enter an email. Since it is a local site, you can enter a fake email such as info@localhost.com.

Choose a Username (usually "admin").

Enter a password and confirm it.

Chooe the "Defualt country" and "Default time zone".

No need to change the two last items.

Press "Save and continue".

Step 7: Finished! :)

The last step will not take much time, actually it just tells you Drupal site installation is finished!

When Done

When done with your Drupal site and XAMPP, "Stop" Apache and MySQL modules, and "Quit" XAMPP.

 

Comments

This page was very helpful and made installing Drupal simple and easy. One suggestion -- for the beginning of step 2.3 you might add a line stating that you need to open a web browser and enter <host>/drupal7 to start the installation.

Thanks!

Kelly,
The line added :)
Thank you so much for the suggestion.

Another suggestion: Before installing XAMPP I had to change my UAC-settings in msconfig to Level 1, to make Apache run properly later on. Also, Apache uses the ports 80 and 443 by default. Skype uses the same ports, so there is a conflict when both programs run at the same time. Under Options -> Advanced -> Connection the port-settings for Skype can be changed. Maybe these potential fitfalls should be included as a remark.

Thanks for the suggestions, Eric.

Thanks for such a detailed tutorial! I'm dealing with Drupal at my job often, so this manual is useful for me greatly. And I think not only for me. Thanks a lot again.

After step 6 I seem to get this error message 'Fatal error: Call to undefined function field_attach_load() in C:\xampp\htdocs\drupal7\includes\entity.inc on line 321', have any idea how to resolve this?

The best way to find the reason of these kind of errors is to Google, and ask in Drupal.org forums.
I googled it for you, and found:
http://drupal.org/node/481758 & http://drupal.org/node/1462258 &
http://support.themesnap.com/entries/20676046-fatal-error-call-to-undefined-function-field-attach-load-in-c-wamp-www-ecommercepro-includes-entity-
 

great post

tengo el mismo problema; no hallo la manera de resolverlo ni entradno al foro de drupal; si algien puede darnos una ayudita a esto gracias.

Call to undefined function field_attach_load() in C:\xampp\htdocs\drupal\includes\entity.inc on line 321

Thanks a lot for this tutorial ! Clean and clear, just what was looking for ! Let's start drupal now ! ^^

You are very welcome. Happy Drupaling! :)

Thanks tutorial is simple and easy to understand. It helped me alot.

Why espouse XAMPP when the MUST READ part of the XAMPP docs @ http://www.apachefriends.org/en/xampp-windows.html states that XAMPP should not be run in production (without a lot of security re-configurations and some manual config steps)? Better to run a production-ready AMPP stack rather than find you've strange problems in production that you don't have in your debug environment (a common occurrence)

XAMPP is just easy and fast to install and use. But of course it is proper for testing purposes (and may be local development), and not production purposes.
Thanks ellayararwhy.

Very easy easy to follow step by step. I actually followed this using Wamp instead of Xampp, primarily because that is what is already on my PC. It has a couple of extra steps than Wordpress does but it is every bit as easy.

Thanks for the lesson.

Oh having trouble getting acknowledgement email sent to m'self from drupal to approve anonymous user sign on

worried me : ( from your tutorial excellent as it is )
"Enter an email. Since it is a local site, you can enter a fake email such as info@localhost.com.

Does this mean Xamp cant perform email function on local host ?

Need to test my site

kind regards

Phil

Hi phl,
Yes. Unfortunately you can't (as far as I know). And check this out: drupal.org/node/261008

It's remarkable designed for me to have a site, which is useful for my knowledge. thanks admin

After installation everything seemed fine. XAMPP then told me that MySql was insecure because of no root password. So i set a password. Now when I go to localhost://drupal7, I get

The website encountered an unexpected error. Please try again later.
PDOException: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) in lock_may_be_available() (line 167 of C:\xampp\htdocs\drupal7\includes\lock.inc)

Thanks for any help.

Try this:
Find "settings.php" located in SiteRoot\sites\default. Then open it, and edit the line indicating database password: 'password' => '', and write the password you chose for MySQL between quotes like : 'password' => 'yourPassword', . For me it's line 220.

Thank you - that worked!

Question: Is a really a security risk to leave the passwords blank - i.e., could someone access my computer via php with a blank password when I install Drupal as above for local development?

You are very welcome, jlady.
Answer: I doubt it, but I am not sure. I think it is almost impossible.

Thank you very much.

great article

Thank you v much. This was really helpful......

Great walkthrough. Made it very simple for a noob.

Only suggestion I have is to mention the potential XAMPP/port conflict. Port 80 is already in use and I didn't know enough to fix it. Fortunately, I found a quick fix. Hopefully it can help someone else.

In the Apache httpd.config, find where it says "Listen 80". Change that to an unused port (I used 8080) and you should be good to go. You'll just have to amend your urls to include the port. Like, localhost:8080/drupal.

Your tutorial was excellent. Just mentioning this because I tripped over it and it might help someone else. Thanks again!

Thank you so much, Eddie.

I have been thinking about working on the Drupal platform as part of a transition that my company is about to make very soon. But the main hurdle was install Drupal 7 locally. But with your steps and tips I could do that quite easily. Now I am all set to start working on it. Thanks a lot!

explanation was clean and clear ,thank you

Add new comment