There are many ways to install PHP on your computer machine.
Install PHP through Xampp software
Xampp is a Windows,MacOs and Linux web development environment. It is the most famous in the market. when you install this software then many software is installed automatically like PHP, Apache, MariaDB, and Perl.
kindly go to the below URL to install the package
https://www.apachefriends.org/download.html
Install PHP through Wamp software
WampServer is a Windows web development environment. It allows you to create web applications with Apache2, PHP, and MySQL. You can download it through the below link.
https://www.wampserver.com/en/
Install package one by one separately
Install packages through a command in Linux.
Install Apache
sudo apt update
sudo apt install apache2
Install PHP
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Install MySql
sudo apt-get install mysql-server
PHP Editor
You can try the code on the editor.
<!DOCTYPE html>
<html>
<head>
<title>PHP Editor</title>
</head>
<body>
<h1>Welcome PHP Editor</h1>
<?php
$msg='PHP code must be write into php tag and click on the "Run" button to view the result.';
echo $msg;
?>
</body>
</html>