2/12/13

PHP: From Home Page to Web Enterprise.(Part-1)


You'll Learn:
  • What PHP is
  • About PHP's history
  • What improvements can be found in PHP 5
  • Some options that add features to your PHP binary
  • Some reasons you should choose to work with PHP
Welcome to PHP! you will look at almost every element of the PHP language. But first, you will explore PHP as a product its history, features, and future.

What PHP is:

PHP is officially known as PHP: Hypertext Preprocessor. It is a server-side scripting language often written in an HTML context. Unlike an ordinary HTML page, a PHP script is not sent directly to a client by the server; instead, it is parsed by the PHP engine. HTML elements in the script are left alone, but PHP code is interpreted and executed. PHP code in a script can query databases, create images, read and write files, talk to remote servers—the possibilities are endless. The output from PHP code is combined with the HTML in the script and the result sent to the user.

PHP is also installed as a command-line application, making it an excellent tool for scripting on a server. Many system administrators now use PHP for the sort of automation that has been traditionally handled by Perl.

What Need Does PHP Fulfill?

There have been scripting solutions for as long as there has been a World Wide Web. As the need to create sites with dynamic content has grown in recent years, so has the pressure to create robust environments quickly and efficiently. Although C can be a great solution for creating fast server tools, it is also hard to work with and can easily produce security holes if not carefully deployed. Perl, a language originally developed for text processing naturally met the demand for dynamic Web environments. Much easier to deploy safely than C, its slower performance has always been more than balanced by the comparatively fast development cycle it offers. Even more useful has been the increasing availability of a large number of stable code libraries for Perl.

So where does PHP fit in? PHP was written especially for the Web. Many of the issues and problems faced by Web programmers are addressed within the language itself. Whereas a Perl programmer must use an external library or write code to acquire data submitted by the user of a Web page, PHP makes this data automatically available. Whereas a Perl programmer must install modules to enable her to write database-driven environments, PHP bundles a powerful SQL database library and provides built-in support for a whole range of third-party databases. In short, because PHP has been created for Web programmers, it has a set of functions for almost any typical problem you might encounter, from managing user sessions to handling XML documents.

So, do we have to pay for this ease of use with even slower performance? Not at all. PHP is designed to run as a module with many server applications, which means that there are none of the start-up overheads associated with CGI scripts. The fact that many typical tasks are handled by PHP means that developers are freed from reliance on utility libraries that can slow things down.

It is not the case that PHP does not provide libraries, though. Perl has the Comprehensive Perl Archive Network (CPAN), and PHP has the PHP Extension and Application Repository (PEAR)—its own repository of powerful packages that extend PHP's power.

No comments: