You can use an online service to create a website, or build it offline using a desktop software tool. WordPress is a free, open-source, easy-to-use and yet powerful content management system, the most popular website builder in the world. Today, we will walk you through the steps to create a local website with WordPress on your Windows PC. As WordPress requires PHP and MySQL database, we will make use of another free software, XAMPP, to turn our computer into virtual Apache web server so we can create and run websites on local machines.
Step 1. Download XAMPP installer
You will see XAMPP is cross-platform and ready to download for various OS including Windows, Linux, Mac OS. Since we are discussing how to install XAMPP on Windows PC in this article, we are using a Windows 11 computer, so we will choose the Windows version.
XAMPP 8.1.10 is the most recent version for Windows as of Oct 2022. It includes: Apache 2.4.54, MariaDB 10.4.24, PHP 8.1.10, phpMyAdmin 5.2.0, OpenSSL 1.1.1, XAMPP Control Panel 3.2.4, Webalizer 2.23-04, Mercury Mail Transport System 4.63, FileZilla FTP Server 0.9.41, Tomcat 8.5.78 (with mod_proxy_ajp as connector), Strawberry Perl 18.104.22.168 Portable.
Once you downloaded the XAMPP installer, go to find it in Finder on Mac or File Explorer on Windows. In this case, we’re using a Windows 11 computer, and saved the xampp-windows-x64-8.1.10-0-VS16-installer.exe file to the Downloads folder on PC.
Step 2. Download WordPress installer
Visit WordPress official website to download the WordPress installer. The current version is WordPress 6.0.3 which was released on October 17, 2022. It requires PHP 7.4 or greater and MySQL 5.7 or MariaDB version 10.3 or greater. So we can see it is compatible with XAMPP 8.1.10 which we have downloaded above.
Once finished downloading, you will save the WordPress installer as a zip file to the Downloads folder as well on your PC.
Step 3. Install XAMPP on PC
Double click on the XAMPP installer in the Downloads folder on your PC to start the installation. During the installation process, you can get warning pop-ups.
If you get this installation warning about User Account Control, see below screenshot.
You should avoid to install XAMPP to C:\Program Files directory so you won’t encounter the writing permissions issue during the setup process. Click Yes to start the installation process, the XAMPP Setup Wizard will open. Click on the next button to proceed.
1. Select Components
You will have the options to select the components to install, such as MySQL, FileZilla FTP Server, Mercury Mail Server, Tomcat, Perl, phpMyAdmin, Webalizer and Fake Sendmail. Uncheck the components you do not want to install. You will have to install at least the MySQL and phpMyAdmin for the WordPress installation. You can see that there are some options that are grayed out such as Apache, PHP. These are the options that are required to run the software and will be installed automatically.
2. Choose installation folder
You can choose the default location or any location of your choice. Remember the warning dialog before the setup wizard above? If you see the same warning, you should avoid installing it to the directory as specified in the warning. Here we will create a folder on a non-system drive for the XAMPP installation. Open the File Explorer on your Windows PC to create a new folder for the XAMPP. In this case we will install XAMPP to D:\software\xampp so as to save the space on our system drive C.
3. Select Language
Select either English or Deutsch from the Language list for XAMPP Control Panel. Be patient and wait for the installation to complete. Once the setup wizard has finished installing XAMPP on your computer, you will be asked whether you want to start the control panel immediately. You can choose to start it later. Now quit the Wizard and optionally go to delete the XAMPP installer from the Downloads folder in Windows File Explorer.
Step 4. Install WordPress on PC
A WordPress website consists of two main parts web files and a database. We will need to firstly create a folder on computer to save those web pages and files; then create a database which stores most of your website content including posts, comments, links and website settings; create a database connection between the two parts; finally run the WordPress web installer.
1. Create a folder for WordPress
Open Windows File Explorer, browse to the location where XAMPP was installed to. In this case, we installed it to D:\software\xampp. Open XAMPP folder, you will find a sub-folder named htdocs. Open this folder to create a sub-folder for WordPress installation. For example, you can simply rename it to wordpress, so it will be installed to D:\software\xampp\htdocs\wordpress.
Go to open the Downloads folder to find the WordPress installer. Copy or move it to the above WordPress folder which we have just created.
Right click on the WordPress installer, a zip file, to unzip it using the any standard zip utility. Although you can always rely on third-party tools such as 7-Zip, WinRAR, Windows 11 ships with native support to zip and unzip files quickly, which means that you can directly extract zipped folders from Windows File Explorer. Select the .zip folder or file in File Explorer, then click the Extract all button from the top toolbar. The Extract Compressed (Zipped) Folders dialog pops up. Click the Extract button to extract all the files. Alternatively, you can right click on the zip file, then choose Extract all item from the contextual menu to extract it.
Once you extracted the WordPress website files, you will find most of them are php files. You can’t double click to view a php file using your web browser on computer. It is a server-side language, which means that it runs on web hosting server and virtual hosts or servers created with XAMPP, WAMP or other similar software. PHP is a programming and scripting language to create dynamic interactive websites. WordPress is written using PHP as the scripting language.
If you found the WordPress files are extracted to many sub-folders, you can move them to the parent folder. For example, you can move them from D:\software\xampp\htdocs\wordpress\wordpress\wordpress-6.0.3 to D:\software\xampp\htdocs\wordpress\ so you can access them more quickly in the future.
Again, you can go to delete the installer for WordPress to save more space on your computer now.
2. Create WordPress database
WordPress is a database driven web platform. A database is a structured set of organized data. WordPress will store most website data in its database. When we downloaded the WordPress installer online, we have been informed that it requires MySQL or MariaDB database. Still remember it? WordPress 6.0.3 requires PHP 7.4 or greater and MySQL 5.7 or MariaDB version 10.3 or greater.
Follow these easy steps to create a database for WordPress in XAMPP.
Start the XAMPP Control panel if not yet. Based on our experience, you can run XAMPP as administrator on Windows PC to avoid possible application error.
Then click to start both Apache and MySQL modules. Click the Admin button for MySQL to open http://localhost/phpmyadmin/ in the default web browser on your computer.
This is the web interface you can manage local databases. phpMyAdmin is an open-source web-based application with an easy-to-use user interface. Many web hosting service providers also have phpMyAdmin in their control panel. We can use this free tool to manage WordPress database on our local computers.
Click Database from the top toolbar, type in a name for your WordPress database in the Database name box, like ‘wordpress‘ or ‘blog‘ are good. Since you are using XAMPP on your personal computer, you don’t need to worry about duplicate names. If you plan to migrate the database and your WordPress site from local machine to online server in the future, you can check your hosting service requirements so that you can follow them on your own server and be able to transfer your database without modification.
As for the collation for your language and encoding, normally you don’t need to change it. phpMyAdmin sets it to “utf8mb4_general_ci” by default, simply leave it to the default collation.
Hit Create button to create your first database with phpMyAdmin.
3. Create database connection
WordPress uses PHP as the language of instruction to create, read, update, and delete data from the MySQL database. Up till now we have copied WordPress files to its folder using Windows File Explorer, we have also created a database for WordPress using phpMyAdmin. It’s time to create a connection between them so the php files can access the database.
WordPress database connection is defined in the connection string which you can find in the wp-config.php file in your WordPress installation. In Windows File Explorer browse to the location where your local WordPress files are saved. We have created a folder for WordPress on our computer above. If you can’t remember, scroll up to find the details.
In the root directory of your WordPress installation, you should find the wp-config-sample.php file. Click to select the file in File Explorer window, then click the Rename button in the Ribbon at the top of the window. You will then see the name of the php file being highlighted and a thin boarder placed around it. Then rename it from wp-config-sample.php to wp-config.php. You can type in the new name or simply select and remove the ‘-sample’ from its original name.
Right click on wp-config.php, choose Open with, select Notepad or any other text editor you have to open this configuration file on your Windows PC. Locate the following lines of code:
Replace “database_name_here” with your database name. We have created a new MySQL database in phpMyAdmin above. If you forgot the database name, you can find it from phpMyAdmin. Replace “username_here” with “root”, delete “password_here” without the quotes, and leave database hostname to localhost without any change. Save the changes to the wp-config.php file and close this file.
4. Install WordPress on PC
Now comes the last step to install WordPress on our computer using a web browser. Open your preferred web browser on your PC, Edge, Firefox, Chrome or else. And visit this link http://localhost/wordpress/. This is the website URL to our WordPress site on local machine. If it is the first time your access it of you have not set up the WordPress site on your PC yet, you will be taken to the home page of the WordPress installation, http://localhost/wordpress/wp-admin/install.php.
First of all, select the language of your WordPress dashboard, the control panel you use to manage your websites. Then click Continue.
Now you will see the welcome page of the famous five-minute WordPress installation process. You just need to fill n the required information here. Do not worry, you can always change these settings later from the WordPress dashboard.
- Site Title: the name of your website, optionally with short description. For example, Vimeo has the site title: Vimeo | The world’s only all-in-one video solution. You can put your brand name, company name, product name in the site title.
- Username: the login username to your WordPress control panel.
- Password: the login password for above user. You will need this password to log in. Please store it in a secure location.
- Your Email: your active email account; important emails will be sent to this email address such as new user registration, new comment notification, password recovery, etc.
- Search engine visibility: since it is a local website on your computer, search engines won’t be able to crawl or index your website. It makes no changes whether to enable or disable it.
- Install WordPress: Click Install WordPress button at the bottom. Now you have successfully installed WordPress on your computer, and you can now log in to your newly installed WordPress.
If you have followed above steps to install WordPress to http://localhost/wordpress/ on your PC, you can now access WordPress dashboard from http://localhost/wordpress/wp-login.php using the username and password you have chosen during the installation process. Try to publish any post or page from the control panel, and start creating your first WordPress website on local machine.
Last but not least, remember to run XAMPP and start both Apache and MySQL modules from XAMPP control panel whenever you like to manage your local WordPress site on computer. Stop these modules and quit XAMPP when you don’t need it. Based on our experience, you can run XAMPP as administrator on Windows PC to avoid possible application error.