Introduction to PHP
PHP Stand for "Hypertext Preprocessor". PHP is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
PHP Stand for "Hypertext Preprocessor". PHP is a widely-used open source general-purpose scripting language
that is especially suited for web development and can be embedded into HTML. PHP is a powerful tool for making dynamic and interactive Web pages.
- PHP is an acronym. Originally, PHP stood for Personal HomePage, because lots of programmers used it to build their websites, going much further than what was possible with HTML,
- In the last few years, "personal homepage" tends to sound more like something that happens on oneof those really cheap hosting sites, rather than a high-powered
programming language. So now PHP stands for PHP: Hypertext Preprocessor.
- The acronym PHP stands for something that actually contains the acronym PHP within itself.
| PHP: Hypertext Preprocessor |
|imperative, object-oriented, Procedural, reflective |
|Appeared in ||1995 |
|Designed by ||Rasmus Lerdorf |
|Developer ||The PHP Group |
|Stable release ||5.3.8 (August 23, 2011) |
|Preview release ||5.4RC1 (November 11, 2011) |
|Typing discipline ||Dynamic, weak |
|Major implementations ||Zend Engine, Phalanger, Quercus, Project Zero, HipHop |
|Influenced by ||C, Perl, Java, C++ |
|Implementation language ||C |
|OS ||Cross-Platform |
|License ||PHP License |
Usual filename extensions
|.php, .phtml .php4 .php3 .php5 .phps |
|Website || www.php.net |
PHP 1.0 announcement that I posted to
the Usenet newsgroup
in June 1995
|From: firstname.lastname@example.org (Rasmus Lerdorf)|
Subject: Announce: Personal Home Page Tools (PHP Tools)
Announcing the Personal Home Page Tools (PHP Tools) version 1.0.
These tools are a set of small tight cgi binaries written in C.
They perform a number of functions including:
. Logging accesses to your pages in your own private log files
. Real-time viewing of log information
. Providing a nice interface to this log information
. Displaying last access information right on your pages
. Full daily and total access counters
. Banning access to users based on their domain
. Password protecting pages based on users' domains
. Tracking accesses ** based on users' e-mail addresses **
. Tracking referring URL's - HTTP_REFERER support
. Performing server-side includes without needing server support for it
. Ability to not log accesses from certain domains (i.e.. your own)
. Easily create and display forms
. Ability to use form information in following documents
Here is what you don't need to use these tools:
. You do not need root access - install in your ~/public_html dir
. You do not need server-side includes enabled in your server
. You do not need access to Perl or Tcl or any other script interpreter
. You do not need access to the httpd log files
The only requirement for these tools to work is that you have
the ability to execute your own cgi programs. Ask your system
administrator if you are not sure what this means.
The tools also allow you to implement a guestbook or any other
form that needs to write information and display it to users
later in about 2 minutes.
The tools are in the public domain distributed under the GNU
Public License. Yes, that means they are free!
For a complete demonstration of these tools, point your browser
Here's the PHP Version 2 (PHP/FI)
announcement I sent in April 1996
|From: email@example.com (Rasmus Lerdorf)|
Subject: ANNOUNCE: PHP/FI Server-side HTML-Embedded Scripting Language
PHP/FI is a server-side HTML embedded scripting language. It has built-in
access logging and access restriction features and also support for
embedded SQL queries to mSQL and/or Postgres95 backend databases.
It is most likely the fastest and simplest tool available for creating
database-enabled web sites.
It will work with any UNIX-based web server on every UNIX flavour out
there. The package is completely free of charge for all uses including
. Access Logging
Log every hit to your pages in either a dbm or an mSQL database.
Having hit information in a database format makes later analysis easier.
. Access Restriction
Password protect your pages, or restrict access based on the refering URL
plus many other options.
. mSQL Support
Embed mSQL queries right in your HTML source files
. Postgres95 Support
Embed Postgres95 queries right in your HTML source files
. DBM Support
DB,DBM,NDBM and GDBM are all supported
. RFC-1867 File Upload Support
Create file upload forms
. Variables, Arrays, Associative Arrays
. User-Defined Functions with static variables + recursion
. Conditionals and While loops
Writing conditional dynamic web pages could not be easier than with
the PHP/FI conditionals and looping support
. Extended Regular Expressions
Powerful string manipulation support through full regexp support
. Raw HTTP Header Control
Lets you send customized HTTP headers to the browser for advanced
Features such as cookies.
. Dynamic GIF Image Creation
Thomas Boutell's GD library is supported through an easy-to-use set of
It can be downloaded from the File Archive at: <URL:http://www.vex.net/php>
the PHP 3.0 announcement from June 1998
|June 6, 1998 -- The PHP Development Team announced the release of PHP 3.0,|
the latest release of the server-side scripting solution already in use on
over 70,000 World Wide Web sites.
This all-new version of the popular scripting language includes support
for all major operating systems (Windows 95/NT, most versions of Unix,
and Macintosh) and web servers (including Apache, Netscape servers,
Website Pro, and Microsoft Internet Information Server).
PHP 3.0 also supports a wide range of databases, including Oracle, Sybase, Solid,
MySQ, mSQL, and PostgreSQL, as well as ODBC data sources.
New features include persistent database connections, support for the
SNMP and IMAP protocols, and a revamped C API for extending the language
with new features.
After this the version php 4 , php 4.1.1
and Later version is PHP Version 5
Features of PHP
There are three main areas where PHP scripts are used
- Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a web server and a web browser. You need to run the web server, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming.
- Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks.
- Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs.
Syntax of PHP
A PHP scripting block always starts with
and ends with ?>. A PHP scripting block can be placed
anywhere in the document.
On servers with shorthand, you can start
scripting like "<? and
Php with html
"DEEPAK DWIJ welcomes you !"; // echo is used to print a Text.
Each code line in PHP must end with a