XAMPP Local WordPress Theme Developer
XAMPP WordPress localhost theme developer picture program expression.
XAMPP, which stands for Cross-Platform (X) Apache, MySQL, PHP and Perl, is a popular, free and open source web server package that you can use to install a web server onto your desktop.
XAMPP allows you to develop PHP and Perl-based server-side scripting applications without the need for a remote web server, offering you the opportunity to work faster, develop stuff more securely, and work on your apps without an internet connection.
In this tutorial – youâ€™ll see exactly how XAMPP can do splendid things to your development cycles.
Weâ€™re going to use a simple xampple (sorry, I had to get that out of the way, been thinking about saying that for a long time): weâ€™re going to install XAMPP and WordPress with some test data to have WordPress right on our desktop.
This tutorial is for Windows Vista, so youâ€™ll have to tweak the steps involved depending on your operating system. Hereâ€™s what youâ€™ll be doing in this tutorial:
- Downloading and Installing XAMPP
- Starting up your Apache and MySQL services
- Installing and configuring WordPress locally
- Creating a MySQL database for WordPress
- Creating a MySQL database user for WordPress in phpMyAdmin
- Importing some test data for WordPress using an XML file
This tutorial covers installing XAMPP in Windows Vista, so youâ€™ll have to tweak the steps a little bit if youâ€™re using a different operating system.
Obtaining XAMPP and choosing a version
1 Obtain a copy of XAMPP for Linux, Windows, or Mac OS X at the apache friends XAMPP web page.
2 Choose the package you want: for normal web development, just go with the Basic Package.
The Basic Package comes with a host of useful applications, libraries, and extensions such as phpMyAdmin (which weâ€™ll use to set up WordPress later on) and eAccelerator (a popular PHP caching application to optimize and improve PHP script performance). For this tutorial, choose the Installer version.
Download it (Save File) onto your computer.
3 Open up the executable (for Windows users, itâ€™s called xampp-win32-1.7.1-installer.exe).
The following figure shows the first dialog box; it asks you to select which language you want to use.
The next dialog youâ€™ll see is the first page of the XAMPP Setup Wizard.
4 Pick a destination for the installation.
Note: XAMPP suggests not to install it in the Program Files folder (i.e. C:\Program Files\xampp), so just install it in the root of your drive (C:\xampp)
5 Configure your options in the XAMPP Options dialog box. For this tutorial, just go with the default installation options.
Thatâ€™s it for the installation, quick and painless wasnâ€™t it? Letâ€™s fire up Apache and MySQL.
Starting up your Apache and MySQL services
6 After the installation, you shouldâ€™ve been presented with an option that asks you to open the XAMPP Control Panel. If you didnâ€™t get that option, do one of the following:
Option 1: Navigate to it using the Windows interface
Start > All Programs > Apache Friends > XAMPP > XAMPP Control Panel
Option 2: Open the XAMPP Control Panel directly
If you didnâ€™t select the “Create Shortcut” option in the installation, then navigate to the XAMPP installation folder and open the file called xampp-control.exe.
7 The XAMPP Control Panel should look like the following figure:
8 Click the Start button beside Apache. If youâ€™re on Windows, youâ€™ll get a Windows Firewall warning: choose Unblock.
9 If all goes well, you should see the XAMPP Control Panel log updated with “Apache Started”, and “Running” with a green background right beside the Apache service.
10 Start the MySQL service using the same method as step 8.
Testing to see if it works
11 With your Apache and MySQL services started, open up a web browser and navigate to localhost using the following path:
12 You should see the following screen:
Congratulations, you now have your very own locally hosted (localhost) web server!
Now letâ€™s move onto installing WordPress on your machine. First, weâ€™re going to set up your WordPress MySQL database and create a MySQL database user for it. Thatâ€™s the topic for the next section.
Setting up your MySQL database for WordPress
The easiest way to create a MySQL database using XAMPP would be to use phpMyAdmin, which comes with the Basic Package that we installed.
13 Navigate to phpMyAdmin through your web browser. The URL is:
14 Create your WordPress database by entering in a name and pressing the Create button.
In this tutorial, weâ€™ll call it wordpress_db. Youâ€™ll need to remember this value for a later step when we configure WordPress.
This is what the following screen will look like:
Creating a WordPress database user
In real-world scenarios, you should never use the default root user because it has all privileges and you donâ€™t want a simple WordPress bug or vulnerability taking down your entire MySQL service.
This isnâ€™t necessary if youâ€™re only testing locally, but weâ€™re going to do this right to promote best practices.
15 Go to phpMyAdmin home by either clicking on the logo on the top left or clicking on the home icon.
16 Click on the Privileges tab.
17 Click on “Add a New User“
18 For the User name field, type in any name, this tutorial uses wordpress_user for simplicity. For Host, select Local.
For Password, type in a value, but itâ€™s highly recommended that you use the Generate Password button to randomly generate a password for better security.
Once you hit the Generate Password button, click on Copy button right beside it to copy it automatically in the Password and Re-type fields.
Important: take a note of the User name and Password you used, weâ€™ll be using it later on.
Here are the settings used:
19 Set the Global Privileges of wordpress_user. Typically, you should try to limit the privileges of your database users to a minimum to improve security.
For this example, since itâ€™s a local installation – just check all of them. When you go into production, pare down the privileges!
Hit the Go button to create the database user.
20 If everything went well, youâ€™ll see a confirmation that youâ€™ve created the user successfully.
Adding your newly created user to your database
21 In the next screen, in the Database-specific privileges fieldset, in the Add privileges on the following database field, select wordpress\_db.
This will add wordpress_user as a database user of your wordpress table, wordpress_db.
22 Check that wordpress_user has been added to the database by entering your database.
To enter your database, click on wordpress_db in the left-hand navigation.
23 Click the Privilege tab to see all users that have access to your WordPress database. You should see wordpress_user listed in the Privilege section.
Alright, youâ€™ve just learned how to create a MySQL database user using phpMyAdmin. Give yourself a pat in the back before moving on!
Installing WordPress on your computer
If youâ€™re not familiar with the process of installing WordPress, you should take a look at the following guide on the official WordPress.org site first:
This guide will get you up and running with the general process that weâ€™ll be taking. Please take a moment and read it – I promise, itâ€™ll be quick and painless.
24 Download the latest version of WordPress, save it on your computer.
25 Open your xampp folder. Navigate to the htdocs folder.
If you used the default installation destination, the file path is:
26 Open up the WordPress ZIP file you downloaded. Extract the entire contents in the htdocs folder.
Configuring WordPress: entering your MySQL database information
27 Inside the wordpress folder, open wp-config-sample.php file using your favorite text editor.
Fill in the information with your database information. If you followed along and used the same values as this tutorial, you can use these values:
/** The name of the database for WordPress */ define('DB_NAME', 'wordpress_db'); /** MySQL database username */ define('DB_USER', 'wordpress_user'); /** MySQL database password */ define('DB_PASSWORD', 'typeyourpasswordhere'); /** MySQL hostname */ define('DB_HOST', 'localhost');
28 Once youâ€™re done with the configuration file, save it as wp-config.php in the same folder.
Note: You have to save it as wp-config.php and not wp-config-sample.php.
Running the WordPress install script
29 To finish the installation of WordPress, navigate to the install script. Hereâ€™s the file path:
30 If you did everything correctly, you should be greeted by the following screen:
31 Just hit the Install WordPress button, and follow the steps. If this is your first WordPress installation, read the steps of the installation dialog carefully as we wonâ€™t be covering it here in detail.
Testing to see if your WordPress installation works
32 Navigate to the home page of your WordPress installation. The file path is:
If everything went well, you should see the default WordPress home page:
Important: take a note of the auto-generated password or else you wonâ€™t be able to log into WordPress.
WordPress local installation completed!
Woot, you just installed WordPress on your computer! No more FTPâ€™ing or live web development! You can now test your themes or test site updates before going live.
At this stage, you can log into the WordPress administration section:
Alternatively, you can continue in the tutorial (because weâ€™re not done yet).
Next, weâ€™re going to import some test data which you should do when youâ€™re developing WordPress themes to be released to the public.
Importing WordPress test data
Hereâ€™s the direct download link:
34 Log into the WordPress administration section:
35 In the WordPress admin section, go to Tools > Import (using the sidebar navigation on version 2.7).
36 In the Import page, click on WordPress.
37 Browse to the XML file we downloaded (test-data.xxxx-xx-xx.xml).
Hit the Upload file and Import button.
38 Assign the authors of the post. The XML file created a testing author named Noel Jackson for you.
If you donâ€™t want to assign the test posts to Noel Jackson, use the or map to existing field and select the author you want. For this tutorial, assign it to admin.
Click the Submit button.
39 Youâ€™ll be presented with a log of all the changes made by the import process. Examine it if you want to see exactly what happened.
40 Check to see if the import went according to plan. Easiest way is to go to the home page of your WordPress installation (http://localhost/wordpress).
41 In the home page, youâ€™ll see that thereâ€™s now content for your WordPress installation. This way you can easily check and test your theme for public release.
Youâ€™re done, you professional PHP/WordPress developer!
Now you can develop WordPress themes and test changes locally on your computer, just like the proâ€™s, not only speeding up your development cycles, but also being able to securely test updates to your existing themes.