PHP Introduction and Installation
PHP Installation and Compiling
As PHP is server scripting language so to compile PHP code you need a server. PHP program runs on XAMPP and WAMP servers. But I recommend XAMPP. Because XAMPP includes not only PHP but it also includes MySQL, Apache web server, Perl and File Zilla.
Download XAMPP from this site https://www.apachefriends.org/download.html.
Follow given steps to install PHP on local server:
Install XAMPP on C drive. You can Install XAMPP on D and E drive too but I recommend C drive.
Go to start Menu and Open XAMPP. From XAMPP control panel run Apache web server and MySQl. MySQL is an open source RDBMS and Apache is world’s most famous web server.
Now open any text editor like notepad and sublime text. Write your first PHP Program and save it in this directory: C:\xampp\htdocs . Name it “first.php”.
You have to save your PHP program in htdocs file in C/xampp/htdocs . Do not save any other location it will not work.
Now open browser and write localhost/first.php or enter http://127.0.0.1/first.php.
It will show the output of PHP program that you have written. Now you have successfully created your first php program.
Watch this video for live example of writing your first PHP program.