As PHP is server side scripting language and need a server apache or other which supports php so they can understand what code is saying and do processing according to the code.
Tools you need to run your php code are xampp/ that is nice solution which supports php and phpmyadmin and many more things. PHpMyAdmin helps you to create mysql databases tables and other database stuff.
First of all download XAMPP installer from here. XAMPP window Installer
Once downloaded install that on your computer. After you have done installation. Run xampp control panel, and Start Apache, there is mysql as well but you need to start that only when you have something with database.
Once your apache is running using xampp, if that is not running see if there is active application skype, or teamviewer cause they use port 80 which xampp have to use for php start. If skype is running or teamviewer go to their settings and remove port 80 so that is not used anymore. In skype use these options.
Go to tools, Then select options there, Select advanced tab from left sidebar, under advanced select connection uncheck (User port 80 and 443 as alternative for incoming connections.) once you have done check if your apache getting start now. If not try to check all running software and their options.
Once you have started apache from xampp control panel now go to directory of xampp where you installed xampp. Inside xampp directory you will see a folder called htdocs/ This is the directory which can be access via browser using links http://localhost/ or http://127.0.0.1/ Second option is better to use.
Now create a php file and put following code inside your php file remember your php file’s extension should be .php not .html or anything else. Create mytest.php and save this file in your htdocs directory and put following code inside your mytest.php file.
[php]<!–?php Phpinfo(); Echo ‘My php is running out yahoo!’; ?–>[/php]
Reach your file from your browser when apache is running by going to http://127.0.0.1/mytest.php . That’s it if you face any problem please contact me.