Since php is a server side programming language, it is often installed along with a server. In the following, I will show you how to install it with Apache server.
• On Ubuntu:
sudo apt update
sudo apt install php libapache2-mod-php
After the installation, you will have to restart the Apache server:
sudo systemctl restart apache2
• On Windows 10: you can install the open source package XAMPP. Just download the installer, and run it following the instructions. So, you will install PHP, Perl, Apache and Perl using only one installer.