In this blog article we’ll learn how to setup WordPress locally.
Whether you’re a WordPress theme developer or wanted to try your theme out before showing it to your viewers, installing WordPress locally is the best option because you’re doing everything locally so means your WordPress website will run faster & this will save you a lot of time customizing or developing your WordPress site.
You can use many applications to create a local server for WordPress, but I think XAMPP is the best software because it is effortless to use & this is exactly what I will show you here step by step how easy it is to use this software.
Step 1: Download & Install XAMPP
Visit XAMPP website to download the application from this link.
I’m using the Windows operating system so I’ll down the Windows version as shown below.
Install XAMPP software in your Windows drive, in my case that is C Drive.
Step 2: Download WordPress
Now visit WordPress.org & download the WordPress files as shown below.
WordPress files will be downloaded in a ZIP folder, you can extract the files using any compression software as shown below. I’m using WinRAR which you can download from here.
Now you have to copy all the files from the extracted folder which you have to paste it under XAMPP folder later.
Now go to XAMPP folder which in my case is under drive C.
Now open the htdocs folder which is under the XAMPP folder as shown below.
Create a new folder under htdocs folder & name it anything you like. For this example, I’m creating a website on Cats so I’ll call my folder Cat as shown below.
Now paste the copied WordPress files in the Cats folder as shown below.
Step 3: Setting up WordPress & Database
Now we have to setup the WordPress & the database so the WordPress can communicate with XAMPP.
Rename the file name ‘wp-config-sample‘ to ‘wp-config‘ as shown below.
Now I have to create a database name in local server using XAMPP.
Open the XAMPP control panel if it is not as shown below.
Click on ‘Start‘ to start ‘Apache‘ & ‘MySQL‘ as shown below.
The green color indicates that ‘Apache‘ & ‘MySQL‘ are running fine as shown below.
Now it’s time to access the apache server to create a database using any web browser.
Open your web browser & type in the address bar ‘localhost‘ & press enter as shown below.
Now you will be presented with ‘Apache Welcome Page‘ as shown below.
To create a ‘database name‘ you have to access the phpMyAdmin area by clicking on the phpMyAdmin link as shown below.
Now you will be presented with phpMyAdmin dashboard as shown below.
To create a new database click on New as shown below.
You’ll be presented with all the databases you currently have as shown below.
Now type a database name of your choice & click Create. For this example, I’ll use ‘Cats‘ as shown below.
You can see the created database name on your left as shown below.
Now to make WordPress communicate with the database, we’ve to edit a WordPress file called ‘wp-config‘ which we renamed earlier under the cats folder as shown below.
Right-click on the ‘wp-config‘ file & open the file using any text editor of your choice. You can choose any free text editor. Here is the list of few text editors which are totally free.
For this example I’ll be using Brackets which is my favourite text editor.
This is how ‘wp-config‘ file code looks like as shown below.
Don’t worry if you don’t know coding & in fact you don’t need to know coding at all to finish this process.
Pay attention to these three lines as shown below.
Now change ‘database_name_here‘ to your database name the one you created earlier. In my case, it was ‘cats‘ so I’ll change my database name to cats as shown below.
Change ‘Username_here‘ to ‘root‘ as this is the XAMPP apache’s default username as shown below.
Password will be none so remove ‘password_here‘ & leave the commas empty as shown below.
Now save the file.
Now to access the local site, you’ve to type ‘localhost‘ in your browser and the folder name you have created under ‘htdocs‘ in my case, which is ‘cats‘ so I will type ‘localhost/cats‘ as shown below & press enter.
If you followed all the steps above then you will be presented with a welcome screen by WordPress as shown below.
I hope you’ve successfully installed WordPress locally by following this guide but if you face any issues then please let me know in the comment form below.
Now you can create your site title, password & install themes as you normally do on your web hosting.
I hope this article was helpful. Please don’t forget to share this article on social media & with your friends. See you soon with another article.