First of all we need a software package for this. So we’ll use XAMPP for this task. You can download XAMPP from official website of XAMPP. XAMPP OFFICIAL WEBSITE.
Now just install it on your computer.
After complete installation we’ll get this type of icon on our windows start screen or desktop. Just click on that to open XAMPP Control Panel
At Desktop At Windows 8 start screen
Now you’ll see below type of screen in front of you.
Now you have to start a server i.e Apache & a database i.e. MySql. [Note: database is optional but if we want to deal with database then we have to start it]
Okay, now you have almost. done. Now question is that how to execute PHP file on localhost so to do this you have to follow next step.
Now open any browser on your computer and open this link http://localhost or http://127.0.0.1 . Now you will a see a webpage. To add your own webpage. Just follow next step.
Now if you want to add your own webpage then just follow this path in your computer C:xampphtdocs . Now in this folder create a new folder e.g. faduhack & create a index.php file in it.
Now again open your browser & this time open http://localhost/faduhack. If you will open this path in your browser then it will open index.php file in faduhack folder.