In this blog post, I will give a detailed view of installing PHP 8.1.2 on your Windows 11 Operating System.
1. Open a web browser of your choice and search for PHP download. Click on the first link.
2. Once the link opens, go to the downloads tab. Here, you should click on windows downloads.
3. It will redirect you to another page. Scroll down and download the thread-safe version zip file. It will start to download the zip file.
4. Once the zip file is downloaded, go to the location and extract the files. Right-click on that folder and click on extract all. Once it is extracted, cut the folder and place it in a C drive. This is what I generally do.
5. Go inside the folder and you will be able to see the php.exe file. To use this, you should set the environment variable. Copy the path.
6. Click on the search icon and search for environment variables. Once the system properties window opens, click on environment variables.
7. Here, you should double-click on the path under system variables.
8. Click on New and paste the path. Then, click Ok on all the tabs.
9. To check the version of PHP, you should open the command prompt. Click on the search icon and search for cmd. Once the command prompt opens, type PHP -v and press enter. It will show the version of PHP.
10. I am going to create a simple hello world program in PHP to check how it works. I am going to create a folder on my desktop. Right-click and click on New and click on Folder. I am going to name the folder as PHP demo and press enter.
11. Once the folder is created, go inside the folder and create a PHP file. To create a PHP file, right-click and click on New and click on a text document. I am going to name it test and press enter. It will show a warning. Click on yes.
12. Right-click on that file and click on show more properties and open it with the code editor. Once the file is opened in the editor, you should type the editor. The program is provided in the image below.
13. Open the command prompt and run the file by typing php test.php and pressing enter. It will show the output.
14. In visual studio code, you can open the terminal. It will open the terminal in the current folder. Here, you can directly use the command. For this, you need to open the command prompt in this terminal. Now, type the same code which you have typed in the command prompt and press enter. It will show the output.
These are the steps for installing PHP 8.1.2 on your Windows 11 Operating System.