How to install PHP 8.4.3 on Windows 11?

How to install PHP 8.4.3 on Windows 11?

Installing PHP on Windows 11 can seem troublesome, especially if you’re new to programming or web development. However, with the right guidance, you can set up the latest version of PHP quickly and easily. In this article, we’ll walk you through the steps of installing PHP 8.4.3 on Windows 11 and running your first PHP program. Let’s dive in!

Why Install PHP?

PHP (Hypertext Preprocessor) is a popular server-side scripting language widely used for web development. Its flexibility and ease of use make it suitable for developing dynamic web applications. The latest version, PHP 8.4.3, offers performance improvements and new features that enhance coding efficiency and security.

By installing PHP, you can:

  • Create dynamic web pages.
  • Connect to databases.
  • Utilize various programming libraries and frameworks.

Read More: Installing Ubuntu 22.04 LTS on Windows 11 Using VirtualBox

Step-by-Step Guide to Install PHP 8.4.3 on Windows 11

Step 1: Download PHP

  1. Open your preferred web browser and search for “PHP” in your search engine. Navigate to the official PHP website. 
  2. Once on the PHP homepage, click on the Downloads section.
Official PHP website
  1. Locate the Windows Downloads option. Choose the link for the current version, which is 8.4.3 in this case.
Windows download page on the official of PHP.
  1. You will see two versions available: Non-Thread Safe and Thread Safe. We recommend selecting the Thread Safe version. This version is suitable for use with web servers such as Apache and Nginx.
Non-thead safe and thread safe version on the official website of PHP.
  1. Click on the appropriate zip file to start downloading.

Step 2: Extract the Downloaded File

  1. Once the download is complete, navigate to the folder where the zip file was saved.
  2. Right-click on the zip file, select Extract All and specify the folder name as PHP 8.4.3.
Extract files from the zip folder
  1. Click Extract to unzip the files.

Step 3: Move PHP to Program Files

  1. After extracting, right-click on the PHP folder you just created and select Cut.
  2. Navigate to the C: drive and open the Program Files folder.
  3. Right-click in the directory and select Paste. You may need to click Continue to authorize this action.

Step 4: Set Up Environment Variables

To run PHP from the command line, you need to add it to your system’s environment variables:

  1. Open the Start Menu and type “environment variables.” Click on Edit the system environment variables.
Environment Variables in the start Menu of Windows 11.
  1. In the System Properties window, click on the Advanced tab and then on Environment Variables.
In the System Properties window, Advanced tab and  Environment Variables.
  1. Find the Path variable in the System variables section and select Edit.
Path in the system variable.
  1. Click on New and paste the path to your PHP installation (e.g., C:\Program Files\PHP 8.4.3).
Path of PHP installation
  1.  Click OK to save your changes.

Step 5: Verify the Installation

  1. Open the Command Prompt (you can search for “CMD” in the Start Menu).
  2. Type the following command and hit Enter

    PHP -- version
  3. If PHP was installed correctly, you should see the version 8.4.3 displayed.

Step 6: Create Your First PHP Program

Now that PHP is successfully installed, let’s write your first PHP script:

  1. Go to any drive, for instance, the D: drive, and create a new folder.
  2. Inside this folder, right-click and create a new text document. Name it indnex.php. 
Inside folder, right-click and create a new text document
  1. Right-click on index.php and choose to open it with Notepad or Notepad++.
Right-click on index.php folder and choose to open it with Notepad or Notepad++.
  1. Add the following code to your PHP file:

    <?php
    echo ‘Zarnab’;

    ?>
  2. Save the file and close the editor.

Step 7: Run Your PHP Script

  1. Right-click and select “Open in terminal
In the folder, right-click and select “Open in terminal”
  1. When the terminal opens, type the following command and press enter.
    PS D:\Zarnab> dir 

    Only file be visible index.php. Now to run it type

    php index.php
  2. If everything is set up correctly, you should see “Zarnab” printed in the terminal. Congratulations! You have just installed PHP and run your first program.

Also Read: How to Install VirtualBox on Windows 11

Conclusion

Successfully installing PHP 8.4.3 on Windows 11 provides a solid foundation for web development projects. By following the steps outlined in this guide, you can efficiently set up your development environment and leverage the performance enhancements and new features offered by this latest PHP version.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top