In this guide, I’ll explain how to install PHP with XAMPP on Window. If you like to install PHP with Composer and Apache you can refer to this blog post.
PHP is probably the most used server-side programming language in the world and WordPress which powers over 26% of the web is built with PHP. It is easier to build a website with PHP than any other server side language out there.
In order to run and build PHP applications, you need to install Apache or Nginx, MySQL on your machine. XAMPP comes prebuilt with all those packages. So you don’t need to install them separately.
A laptop that runs on window 7, 8, 8.1, or 10.
Let’s get started.
Here you’ll be installing XAMPP.
- Goto www.apachefriends.org to download XAMPP
- Choose XAMPP for Windows
- Wait for your download to start and finish
- Double click on the file you just download to begin installation immediately
- Follow the setup instruction to complete the installation. Installation typically takes 2-15 minutes depending on your machine memory.
Tips: Keep clicking NEXT throughout the installation.
Below are screenshots showing the installation process to completion. You can skip to Step 2.
After a successful installation, by default, it will start the XAMPP control panel.
Your browser might also open up a web page during installation process. DO NOT bother.
XAMPP Control Panel
By default, to run PHP application, you need to be running Apache on your machine. And since you’ll mostly need a database for your website, you also need to run MySQL.
XAMPP provide a simple Control Panel to do this. And all you need is to START Apache and MySQL when you need them.
And to start Apache and MySQL:
Click on the XAMPP Icon on your system to open up XAMPP control panel. You can search by CTRL F then type XAMPP.
Click on the START BUTTONS beside Apache and MySQL.
You’ll be doing this whenever you need to run PHP application. You should always check to make sure your Apache and MySQL is running.
Now visit http://localhost on your browser to open XAMPP dashboard.
On the TOP RIGHT NAVIGATION links click on PHPInfo to see your PHP installation details.
Building PHP Projects
Finally lets create simple hello world app and run.
Now, to do this, go to your XAMPP installation folder. This is normally located in C:\XAMPP.
Inside the XAMPP folder, you’ll see a folder name htdocs.
The htdocs folder is where you’ll be creating all your PHP website projects.
In the htdocs folder, create a folder and name it helloworld.
Open a text editor on your system (e.g Notepad) and type the following code:
<?php echo "Hello, World!"; ?>
Save it as index.php inside the helloworld folder you just created.
Make sure Apache and MySQL are running.
If you follow the instruction correctly, you can now run PHP projects on your Window machine. Feel free to ask me any question on the comment box.