Install PHP

Table of Contents

Last Updated: April 2, 2021

In this tutorial we will show you how install PHP on Windows, MacOS and Ubuntu


  1. Go to

  2. Download the latest stable ZIP version

    Figure 1. Download PHP Windows
  3. Extract the downloaded file to your preferred location e.g. C:/PHP

  4. Add the folder to system environment

  5. Inside any folder, right click on This PC then choose properties

    Figure 2. Add PHP to Windows environment variable
  6. Choose Advanced system settings

    Figure 3. Add PHP to Windows environment variable
  7. Click on Environment Variables…​

    Figure 4. Add PHP to Windows environment variable
  8. In the System variables section, select Path variable then press on edit

    Figure 5. Add PHP to Windows path variable
  9. You want to add your PHP extracted folder to the Path variable, so press on new and paste you folder location, then press ok

    Figure 6. Add PHP to Windows path variable
  10. To check if PHP was installed successfully, from the command line type

php -v

-s You should get the following


Figure 7. Run PHP Windows


By default MacOS ships with PHP, but you can replace it with any version you want in one line command.


  • Homebrew

  • xcode developer tools

    1. Using the terminal use the following to upgrade to the latest version

brew install php

And you can use the following for a specific version

brew install [email protected]
  • You should find PHP config file in the following directory



  1. Update the list of available packages then install the newer versions of the packages

    apt-get update && apt-get upgrade
  2. Install PHP

    apt-get install php
  3. Test if it is working

    php -v