PHP With MySQL For Beginners Day 1

Leave a Comment

What is php?


PHP is a server scripting language. Now you may have thought that PHP was a programming language. Well, technically speaking, it's not. So how's a scripting language different from a programming language? A script only runs in response to an event. It also usually runs a set of instructions by working down the page from the start to the end. It has little or no user interaction after that initial event. So PHP script does not run until a web page is requested. Then it launches, follows its instructions from top to bottom, and then quits until another action launches the script again. On the other hand, a program, runs even when not responding to events. It continues to run, and to wait for interaction.


History of PHP


Php Version 1 was written by Rasmus Lerdorf in 1994.Version 2 was a more formalized version that he put out in 1995. But in version 3, PHP changed dramatically. Two other developers got involved, Zeev Suraski and Andi Gutmans. These two developers rewrote major parts of PHP between 1997 and 1998. they also renamed it PHP hypertext preprocessor. Now you can see that in those three words we still have the initials P, H and P, but the first word in the acronymn is the acronym itself.After that Php 4 is responsible for making PHP incredibly popular. PHP 5 includes a lot of new features, such as better performance, improved object oriented programming and some better database connectivity.

Why we have choose PHP?


First of all php is my fav scripting language. There are many reasons to use PHP. This first is obviously that you've discovered the limits of HTML and now you need something more. Php is open source. Open source means the source code is available for all to study , to modify or to user.
And its free software so its free to download and free to user there is nothing purchase or no licensing fees. I want to tell you one more thing php also cross platform to develop and deploy. So its means you can php any where on windows , linux or mac server. I think its enough of convince why we have to use php. Facebook is in php. I think you have to watch this The Social Network Movie. This is my one of favorite movie this movie inspire to learn php
I hope after all this thing. you're excited to get started. So lets check what we need to run php.

1) Web Server
2) Database Server
3) Text Editor
4) Browser

For Web Server we don't need to buy domain or any server. We can run php on our local machine we have to just download few software which are free no need to by license.
Those combinations we refer to as The Stack. And the different stacks that are most popular are referred to as LAMP, MAMP, WAMP, and XAMPP. For LAMP, it's LAMP, which stands for Linux, Apache, MySQL, and PHP. And then for the M, it stands for Macintosh, the W in WAMP is for Windows, and the X is for all three of those.
I am using windows so i will go for XAMPP as a server and sublime as text editor.Download XAMP From here. After download just double click and click on next you php and phpmyadmin will automatically install.

Now that we have PHP installed. Were ready to start learning how to use it. So let's start with our first php program. Open your text editor copy paste this below code
<?php echo "Hello Php now i started work on you"; ?>

Save this file as Hello.php I am using windows with xampp so my root directory is C:\xampp\htdocs. Under htdocs i created Php and inside that day1 folder to save my file you can see in image



After writing your php program we have run this file in browser so for that localhost/filename.php. If you have file inside folder then localhost/foldername/filename.php. To run my file http://localhost/Php/Day1/Hello.php i will run like this.
If its give this kind of page



Its means you did't start your Xampp server so start your xampp server



Again hit the url then you are go Congratulations your first php code is run



So, guy's that it for the day1. For day2 we will start with combination of html and php and declare php variable and more cool things

Guy's if you like this please comment below or share this page with you frnds. If you any problem or question please ask to me on comment
Powered by Blogger.