What is PHP ?
PHP (Hypertext PreProcessor) is a general-purpose programming language developed by Rasmus Lerdorf in 1994 for web development. This is one of the most popular programming language for beginners in web development because of its simplicity, large community and accessibilty.
Steps to setup PHP environment on a local machine: There are basically two ways to set up PHP on a local machine which are:
- Using all in one package (XAMPP & WAMPP). (recommended)
- Manually install all the required packages (MySQL, PHP & Apache) and configure them.
We are going to cover an easy and almost error-free method to install PHP on a local machine which is by using all in one package called XAMPP.
Steps to Installing XAMPP:
- Downloading XAMPP: You can download the XAMPP software from the official website here with the latest windows version and latest PHP version.
- Open the downloaded .exe file: After opening the downloaded file you will see a popup from windows, click yes and proceed further.
- Click on ‘next’: You’ll see a welcome window of XAMPP like below, click next.
- Select the components: Select the components you want to install. Please select the MySQL and phpMyAdmin components, all other components are optional for this tutorial.
- Select the installation location: Select the location you want to install the XAMPP, the default is C:\xampp.
- Click next: Your clicking next, your installation will begin.
- Open XAMPP control panel: After successfully installing the XAMPP in your local machine open the control panel by searching in the windows search bar for ‘XAMPP control panel’ or by going to the installation directory of XAMPP. You’ll see a window like below.
- Configuring Apache*: This step is optional i.e. if you are having some issues on windows 10 related to blocked port.
Open the configuration file for Apache as shown in the image below.
CTRL + Fand search for
LISTEN 80. Replace the port 80 with something like 81 and save the file and restart control panel.
- Start the Apache server: Start the Apache server by clicking the start button you’ll see a port number just in front of the Apache column. You can stop the service whenever you want and start any service by just clicking the start button.
- Checking the installation: Go to your browser and type localhost:81 (or simply localhost in case you haven’t changed the port). You’ll see a page like below.
- Checking PHP installation: Create a php file in
htdocsfolder in your installation directory. (
C:/XAMPP/htdocs) and add the following code in it.
Save the file as demo.php and go to your browser and type
localhost:81/demo.php(or simply localhost/demo.php in case you haven’t changed the port).
If the installation goes fine you’ll see a result like below.
If all the above things have gone fine then Congratulations! you have successfully set up a PHP development environment in your local machine.
- ReactJS | Setting up Development Environment
- Environment setup for JSP
- ES6 | Environment Setup
- Environment Setup in Ruby
- Setting up the environment in Scala
- How to get the value of System Property and Environment Variable in Java?
- Creating Knockout Application along with Setting up Environment in Visual Studio
- Tricks in Windows 10 | Set -1
- How to use Emojis in Windows 10?
- Difference Between DOS and Windows
- Windows Shortcut Keys
- Installation of Node.js on Windows
- How to Create a New User in Windows 10?
- How to Hide a Folder in Windows?
- How to install XAMPP on Windows ?
- How to close a dialog box in windows?
- Windows 10 Toast Notifications with Python
- How to Create an Unnamed file in Windows?
- How to update Sound Drivers in Windows PC?
- How to disable Windows Startup services?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.