This step-by-step guide will explain to you how to manually install PHP on Windows 10. After that, you can use it to install PHP on your computer and test websites and applications on your local host or set it up on a remote server. If you have already moved to Windows 11, the steps will be the same, so you could still use this guide.
Step 1: Download PHP from the official site.
You will need to visit the official site of PHP.
There, in the Download tab, you will see the different versions. Get the latest Stable PHP version. At the moment, this is PHP 8.1.1.
Click on the “Windows downloads”, and then you will see all of the versions for Windows. Find the right one based on the architecture of your processor – 64bit (x64) or 32bit (x86). If you are not sure, press the Start button, type ”System information”, and open the application. It will show you the answer.
Click on the Zip archive (Thread safe) and download it.
Step 2: Extract the ZIP file
Locate the downloaded file in the Download folder. Then, extract the PHP zip archive to a new folder called PHP on the C: drive of your computer.
Step 3: Setting up PHP configuration inside the php.ini file
By default, you won’t find the php.ini file. You must copy C:\php\php.ini-development to C:\php\php.ini
Inside this file, you must enable some important extensions. You can enable them by deleting the semicolon (;) sign that is located before them.
First, open the php.ini file with the text editor you have (Notepad or Notepad++). Do that by right-clicking on it and then selecting the text editor from the Open with… option. Then, search for the extensions below, and enable them the way we mentioned before.
Extension=curl
extension=gd
extension=mbstring
extension=pdo_mysql
Step 4: Set environmental variable
In this step, we will help the OS to be able to find PHP executable by indicating the PHP path.
Press the Start menu, type “Edit the system environment variables”, and click on it to open it.
Then navigate to Environment variables and click on it.
Now, from the System variables, you need to find the Path, click on it, and then click on Edit.
Here we need to add a new path, so click on New and put the path for the folder of PHP (In our case, it is C:\php). You can type it or copy and paste it.
Step 5: Testing the PHP
By now, the installation should be ready. The easiest way to test if we have successfully installed PHP is to check the version installed on the system.
Click on the Start button, type “Command Prompt”, and click on it.
Inside it, you must type “php -v” and press Enter. This will show you the version of the PHP that is running on the device. If it is not successful, it will show an error. In our case, it shows PHP 8.1.1
Congratulation, you have installed PHP on Windows 10.
Install PHP on Windows 10 with XAMPP
There is an easier way to install PHP and be sure that all of the components are installed and running correctly – XAMPP. XAMPP is a free distribution package that includes PHP, database software, and Perl. It is very easy to install, thanks to the graphical interface.
Get IPv4 address with PHP explained
Conclusion
You can manually install PHP on Windows 10 or do it fast with XAMPP. Both ways, the process is straightforward.