Documente Academic
Documente Profesional
Documente Cultură
What is PHP ?
PHP is a server-side scripting language. Now you may be thinking how a scripting
language differs from a programming language. A scripting language does something
only in response to the event while a programming language can do the things even
when it is not responding to events. Javascript is another popular scripting language that
runs on the client side while PHP runs on the server-side. Here server-side means
webserver and client side means user's web browser. So PHP will going to be executed
on the webserver and not the client browser. Since PHP runs on the webserver thus its
not going to run on its on. So it needs a webserver but it will run as it is, that means it
does not need to be compiled like other programming languages lets say : C, C++, JAVA
etc etc. Thus we create PHP program and put it on webserver and we are ready to go.
PHP is designed for use with HTML. PHP code is our input and webpage is our output.
We will save the PHP document with the .php extension so that the webserver will know
that it is a PHP document.
PHP provides more flexibility than HTML alone does. HTML pages are static by nature
and it will show the same pages all the time but PHP let us create dynamic pages. The
page content changes based on the conditions such as interaction with the user or data
stored at the database.
PHP syntax is very similar to C, JAVA,PERL. And if you have knowledge of any of
these languages already, you can recognize the similarities but if you don't have
knowledge of any of these languages then don't worry you don't have to learn any
language before you learn PHP. The only foundation you should have to learn PHP is
HTML.
History of PHP
The version 1 of the PHP was written by Rasmus Lerdorf in 1994 and it was CGI binaries in
C programming language. He was looking for a way to maintain his webpage easier.
The version 2 written in 1995 was more formal version. This was the improved version
of the original version and also combined with the code to interpret information
submitted by web forms and this was the first public release of PHP. At this point PHP
stands for the Personal Home Page Tools.
In version 3, the things changed in 1998. They renamed it “PHP : Hypertext
Preprocessor”.
In version 4, the things changed again by forming the new company called zend
technologies and zend wrote the core of PHP. It was full-featured and was released in
May, 2000. now PHP group maintains PHP and zend technologies (company) actively
guides the developments on the PHP we are using.
Now whatever we will discuss in our tutorials here will be executed by PHP 4 & 5.
Installation
In order to install PHP on your local machine (computer), you will need the following :
1. Webserver: we will install it on our local machine.
2. PHP: we will install PHP so that webserver will understand PHP documents that
we create and serve them to web-browser.
3. Database: We gone a have database so that we can create applications that are
more full-featured.
Installation overview
We can use any of the following packages:
1. LAMP (LINUX – APACHE – MYSQL – PHP)
2. WAMP (WINDOWS – APACHE – MYSQL – PHP)
3. MAMP (MAC – APACHE – MYSQL – PHP)
4. XAMPP (FOR ALL VIZ. LINUX, WINDOWS, MAC)
Windows intallation
To install PHP on windows you will need following prerequisites:
1. PHP requires:
Windows 98/Me or
Windows NT/2000/XP/2003/Vista/7.
2. Apache:
httpd.apache.org
3. PHP:
http://www.php.net
4. MYSQL:
http://dev.mysql.com
you can install these modules of PHP manually as listed above or you can choose all in
one package either WAMP or XAMPP as listed below:
1. WAMP:
http://www.wampserver.com/en/index.php
2. XAMPP:
http://www.apachefriends.org/en/xampp-windows.php
I'll use WAMP in these tutorials so you can install WAMP on you machines. Other
packages can also equally work well.
Text-Editor
The text editor that you can use to write PHP code can be any out of these :
1. Dreamweaver, Zend studio, kromo-edit, notepad++.
2. Word processors are not good for PHP editing. Since they put in lots of other
information like page margin etc. So don't use word processors for PHP editing.
3. Notepad will work for PHP editing.