Install PHP
Last Updated: April 2, 2021
In this tutorial we will show you how install PHP on Windows, MacOS and Ubuntu
Windows
-
Download the latest stable ZIP version
-
Extract the downloaded file to your preferred location e.g. C:/PHP
-
Add the folder to system environment
-
Inside any folder, right click on This PC then choose properties
Figure 2. Add PHP to Windows environment variable -
Choose Advanced system settings
Figure 3. Add PHP to Windows environment variable -
Click on Environment Variables…
Figure 4. Add PHP to Windows environment variable -
In the System variables section, select Path variable then press on edit
Figure 5. Add PHP to Windows path variable -
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 -
To check if PHP was installed successfully, from the command line type
php -v
-s You should get the following
+

MacOS
By default MacOS ships with PHP, but you can replace it with any version you want in one line command.
Prerequisites
-
Homebrew
-
xcode developer tools
-
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
/usr/local/etc/php/7.3/php.ini