Saturday, 6 August 2016

PHP Introduction - Lecture #2

Installing and Running PHP

Hello All... welcome every one. I'm going to start PHP lectures for Very Beginners, who wants to learn PHP from very beginning. No matter if you do not have any basic programming concept. If you follow my tutorials I hope you will surely get some how good knowledge of PHP.
Today our Topic is
`Installing and Running PHP programs`.
As in previous lecture I told you that to run PHP programs you need any of these Servers WAMP, XAMPP 32 or 64 bit according to your Operating System configuration.
First of all download any one of them and install it, for windows users only because I’m using windows. After completing the installing
FOR WAMP
            If you have installed WAMP server go to your C drive there must be folder named `wamp` inside this folder go to `www`. In this folder you should save all your PHP programs and run them. Without this folder your browser will not be showing your files for running.




FOR XAMPP
            If you have installed xampp on your server similarly in your C drive there would be a folder of `xampp` inside this folder go to `htdocs`. Here you must save all of your PHP programs for running purpose.
Remember if you save your files without those folders in wamp and xampp your PHP programs will not be executed at the browser.

After you have finished installing any of these servers open any text editor just simple you ca use notepad or notepad++. And here we go for running our first PHP program.
The syntax of any PHP programs starts with `<?php` and end with `?>`. Whatever we write between these will be considered as part of PHP code. Giving this `<?php` at the starting of any code means we are telling our browser that it’s a PHP code.
Simple PHP syntax
<?php
            echo “hello world”;
?>
The term `echo` used to show what we write in the quotation on the browser. Whatever we will write in echo statement will be shown in the browser. From above code the browser will show just `hello world` not rest of other coding.
You write this code in your editor notepad or notepad++ and save it with .php extension in the C drive of `www` or `htdocs` of folder you are told above.
After Saving this file Open your browser and write `localhost` in your URL as shown in picture below:



At the top URL there is `localhost` written, you just ignore `:8181` this is my own configuration you only write the `localhost` and for WAMP users this page will be opened and below another arrow shows your files that you saved on your C drive of www folder, these are my projects that are saved in that folder. You just click on that file and browser results the output.
Note: Remember you must open your wamp/xampp server before you run any PHP program otherwise your program will not execute.
Here is how you open your wamp/xampp server.

WAMP USERS


I hope you got to know how to install and run a simple PHP program. If so then try to practice yourself by running multiple programs again and again.

Thanks Guys. Any thing missing or any question from this topic you can comment below, I will be trying to solve and answer your question.
Our Next topic will be `PHP Variables`.
Good Luck J


No comments:

Post a Comment