Recipe: To Cook PHP dish (script) with 3 main ingredients (steps)

This post will guide you to write your frist php program using 3 main tools, read further to know more about these tools... 



To cook a delicious PHP dish you just need to mix 3 following ingredients.
1) Web server
2) Text Editor 
3) Database Manager (optional)
4) Web browser (what is this 4th point.. are you faking us..??? ... - "just wait.. keeping reading, shortly you will see yourself.. "

Now, lets have a look why we need all these 

1)  Web-server: Web-server program is like a stove where we would finally cook our written code.
2) Text-editor: It is where , we will chop our requirement(s) into the code using the knife of PHP.
3) Database manager: it is an additional ingredient(tool), which will help us to make our dish more aromatic.
4) Web browser: The Bowls- to serve your hot n' aromatic PHP dish.

Now, let's see in more details- 

firstly, I need to setup php & web server (and your web-server must be running while you are testing your php scripts or any other server side programming language. 

for this work we shall make use of WAMP server in case of PHP script development at Windows machine otherwise LAMP server. 
Well..!! Good question.. "what is this LAMP or WAMP..??"
LAMP - Linux Apache MySQL PHP/Perl/Python & (runs over Linux machine)
WAMP - Windows Apache MySQL PHP ( An application server platform)

After making the decision of whether we are working on Linux or windows environment, lets us check why we actually need this.

It helps us to avoid the installation of separate PHP compiler software & also mysql client & server as well. It installs Apache the WEB server too, without giving any problem to us.

Lastly, about Text editor, why we need this..?

As the name speaks, text editor, lets us to write text, in our case  we are not going to write just Text it is known as `Code` using the semantics of `PHP` the scripting language.
I ll do following to run a php script-

Write code-File name "index2.php" & the location i shall save them- C:\wamp\www\First_PHP\
PHP code chunks 

4) It is where the browser comes into the action, open your favorite web-browser program. and type the following url http://localhost/First_PHP/index2.php (if you have put your file name as just "index.php", you need not to give file name in the url e.g. http:/localhost/First_PHP/ is more than sufficient).
Your Output
You need not to give path to your file if you have open web server only, as you can see in the following screen shot.
WAMP server's landing page or default page or home page
if you have paid attention to the title of this post, there i wrote 3 steps or tools but i have used 4.. why... the answer is as follows:- 

Here is something very important ingredient referred as Web-Server or WAMP , it is taking responsibility of Running your PHP & managing the DATABASE as well. This is why I wrote there only 3 ingredients. :)

Thanks so much!!

No comments:

Post a Comment

Search This Blog

Let make your friend aware about this post