PHP

Introduction to PHP

PHP is one of the server-side embedded scripting language. To write a Web page using PHP, we embed PHP code within HTML. Here's a simple PHP-enabled Web page that displays the current date and time:

<html>
<p>
The current local time is
<?php echo date ("M d, Y h:m:s A") ?>.
</p>
</html>

When someone requests this page, the code portion between the special markers is executed on the server host and replaced by its output, resulting in the final page that the Web server sends to the client's browser.

Thus, when a Web browser requests a PHP page instead of an ordinary HTML page, the Web server wakes up the PHP parsing engine, which runs through the PHP code in the requested PHP file and returns the resulting output to the Web server in HTML format, which in turn is passed on to the Web browser to be displayed to the users.

This approach to Web scripting makes it easy to write dynamic pages that include content generated on the fly at the time a client requests the page. Combined with PHP's support for several database engines (MySQL being one of the most popular), it becomes very easy to query our database from within scripts and display up-to-the-minute content. If we track financial information, our Web pages can look up the current indicators from the database for display to our visitors. If we need to write interactive pages, PHP generates and processes forms. Visitors can fill in a form describing products they want to see; we can run the appropriate query to look up matching items from our database and produce a table that displays information about them.

PHP can also be used to generate graphical or PDF output as well. PHP is designed to operate in a Web server environment without being resource-intensive. This makes PHP well suited for use as a lightweight script-processing engine on high-performance Web sites. PHP's popularity is soaring nowadays. PHP has a shallow learning curve, so it's easy to get started and produce working Web scripts in a short time, particularly if we already know how to program in C. Availability of external support is increasing, too. PHP now has PEAR (PHP Extension and Add-on Repository), an archive serving much the same purpose as the Perl CPAN.

PHP is growing rapidly as an open source with contributions from PHP professionals all over the world and the latest version is PHP 4.0.0. PHP has a number of advantages apart from the fact that PHP is very simple to learn and use. PHP is capable of being fitted in a number of platforms, such as Linux, Microsoft Windows NT, and Windows 98, and Web servers, such as fhttpd, IIS, OmniHTTPd, numerous databases and protocols, such as SNMP and IMAP. The latest version PHP includes support for Java, Java Servlets and XML.

The primary goal of PHP is to allow Web developers to write dynamically generated Web pages quickly.The actual power of PHP arises from the fact that it is possible to seamlessly access several other modules from PHP using the API support that PHP provides. Version 4 is the latest of PHP versions and this comes with Zend, which is a much faster and tighter interpretation engine.

PHP Capabilities

1. PHP performs system functions, such as create, open, read from, write to, and close files on system, execute system commands, create directories and modify permissions.

2. PHP gathers data from forms, save the data to a file, send data via email and return manipulated data back to the user.

3. PHP combines well with MySQL database engine to design Web database, accesses databases and generate content and images on-the-fly, create a Web interface for adding, deleting, and modifying elements within database. A large number of databases are supported for connectivity by PHP apart from MySQL. As of PHP 4, these include Adabas, dBase, Empress, FilePro, Informix, InterBase, mSQL, Oracle, PostgreSQL, Solid, Sybase, Velocis, and dbm. Open Database Connectivity (ODBC) is also being supported.

4. Lightweight Directory Access Protocol (LDAP) is another supported protocol. PHP provides APIs for writing LDAP client programs.

5. Mail protocols such as Interactive Mail Access Protocol (IMAP) and Simple Mail Transport Protocol (SMTP) are supported. Also Simple Network Management Protocol (SNMP).

6. Extensible Markup Language (XML), touted as the future Web language, is also supported. Web Distributed Data eXchange (WDDX), a technology derived from XML is also supported.

6. PHP sets cookies and access cookie variables, start sessions and use session variables and objects, helps for authentication to restrict access to certain Web pages and to encrypt data.

7. Image generation and manipulation functions are supported, and using PHP we can generate images dynamically. The Portable Document Format (PDF) for distributing documents on the web is also supported. PHP scripts can generate PDF documents on the fly using this interface.

Thus PHP is bound to play a very important role in developing well-defined scripts for server-side processing and is an elegant and robust server-side technology in the client/server model of Web computing. Ultimately PHP can facilitate the creation of dynamic, user-responsive, data-driven Web sites.

Click for PHP Links