To start programming with PHP is one of the parts of web development skills and installing PHP In on your Windows 10 machine is considered the first step of learning PHP skills using a local machine. Here we discuss the various method to Install PHP In Windows 10 OS.
- Install PHP in Windows OS using the PHP development environment.
- Manually install PHP by PHP official file Setup.
Install PHP in Windows 10 OS using XAMPP
According to my personal experience, as the time of beginner in PHP development, I always prefer XAMPP as my local server to run PHP files and also do project work. XAMPP stands for cross-platform, Apache, MySQL, PHP, and Perl. You also use it for installing and creating the site on WordPress offline or on your local server.
Now we check how we install XAMPP in our Windows machine step by step,
First, you have to check your system configuration. To check the configuration right click on This PC or My Computer then click on properties, there you can see like below. In my case,
Step 1: Then we have to download the EXE file of the XAMPP server from the official site https://www.apachefriends.org/download.html.
Step 2: After completing the download click on the .exe setup file,
Step 3: Click NEXT and then you can see all the check ticks on all options then click on NEXT.
Step 4: Now after the above screen we can see the selected path where XAMPP can install. You can also specify the installation path according to your choice by changing the same.
Step 5: Now click next on multiple-step then installation starts automatically and after completing the installation of XAMPP, you can see the XAMPP control panel.
Now you can read with your PHP installation on Windows 10 OS using the external PHP development environment XAMPP.
Manually install PHP on Windows by PHP official File Setup
Now we see the quickest steps to install PHP on Windows 10. Noted that there are others ways available out there to install PHP Apache server.
Step 1: Download the PHP files
Get the latest version of the PHP Zip package according to your system configuration from here,
https://www.php.net/downloads.php
Step 2: Extract the ZIP
Extract the PHP zip file and create a new directory named PHP
and store it on you C:
drive.
PHP can be installed on any drive on your windows system but for future steps, I suggest you do not change the path.
Step 3: Setting up the PHP configuration file php.ini
On the very first time, you can not find the php.ini
file. so you have to copy C:\php\php.ini-development
to C:\php\php.ini
On the same config INI file, you have to enable some important PHP extensions by removing the semicolon (;) from their start.
Open you the php.ini
file in your text editor and search for the below extension and enable them.
1 2 3 4 |
extension=curl extension=gd extension=mbstring extension=pdo_mysql |
And if you want to send mail using the localhost, you can check to Send Mail From Localhost in PHP Using XAMPP.
Step 4: Add PHP location on the PATH environment variable
We have to set our PHP path to an environment variable, so OS can find the PHP executable.
To reach the environment variable Click on Advance System Setting,
Then click on Environment Variable and click on PATH > Edit. Now you can create a new variable.
Step 5: Setup Apache Module
First check Apache is not running in the background then open the file C:\Apache24\conf\httpd.conf and put the below code at the last line of the file.
1 2 3 4 |
# PHP8 module PHPIniDir "C:/php" LoadModule php_module "C:/php/php8apache2_4.dll" AddType application/x-httpd-php .php |
Step 6: Test the PHP File
Create a new file named index.php
in Apache’s root directory at C:\Apache24\htdocs
and write the following PHP code which prints the information about your PHP server.
1 2 3 |
<?php phpinfo(); ?> |
Now open your browser and write on the URL bar http://localhost/index.php
or any other file name to run.
Here is the complete step-by-step process to install PHP in Windows 10 or any windows version.
If you got any errors please let me know in the comment.
Also Read:
- Send Mail Attachments with PHP Mail()
- jQuery Contact Form Send Email Using Ajax
- isset vs empty vs is_null in PHP With Example
- How to Get Client Hardware Information Using PHP
Happy Coding..!
You need to fix Step 6. Those tags shouldn’t have been rendered as text. The index.php file won’t work as intended with them there.
Thanks Toby.
Fixed Now
[…] How To Install PHP In Windows 10 […]
[…] Note: If you want to use inbuilt command line interface of Windows OS, you have install PHP manually from PHP official package. Here is the complete step by step process to install PHP How To Install PHP In Windows 10. […]
[…] INI file is created at the time of PHP installation. If you install XAMPP there is also an auto-generated PHP INI configuration that we use to set up the maximum upload size […]
[…] we discuss the Error: Apache shutdown unexpectedly issues with XAMPP. In this complete article, we will know why the Apache and MySQL issue occurs and how we can solve […]
Thank a lot.
[…] we will discuss the Error: Apache shutdown unexpectedly issues with XAMPP. In this complete article, we will know why the Apache and MySQL issue occurs and how we can solve […]
[…] How To Install PHP In Windows 10 […]
[…] How To Install PHP In Windows 10 […]