20-09-2014, 11:50 AM
Hypertext Preprocessor
Hypertext.docx (Size: 620.71 KB / Downloads: 33)
Abstract
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. As of January 2013, PHP was installed on more than 240 million websites (39% of those sampled) and 2.1 million web servers. Originally created by Rasmus Lerdorf in 1995, the reference implementation of PHP is now produced by The PHP Group.
While PHP originally stood for Personal Home Page, it now stands for PHP: Hypertext Preprocessor, a recursive backronym. PHP code is interpreted by a web server with a PHP processor module, which generates the resulting web page: PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. It has also evolved to include a command-line interface capability and can be used in standalone graphical applications. PHP is free software released under the PHP License. PHP can be deployed on most web servers and also as a standalone shell on almost every operating system and platform, free of charge.
Introduction
In 2000, PHP was a little-known open source project. It was adored by technical people in the know but not yet recognized as the popular choice for Web development that it is today.
Today things are different. The Internet has gone through a boom and a bust and has righted itself. Furthermore, PHP is now the reigning king of dynamic Web design tools and has expanded somewhat beyond the realm of just Web development.
1 Brief History
The current version of PHP, PHP 5.3, has been more than fourteen years in the making; its lineage can be traced back to 1994, when a developer named Rasmus Lerdorf first created a set of CGI scripts to monitor page views for his online résumé. This early version of PHP, named PHP/FI, was fairly primitive; although it had support for form input and the mSQL database, it lacked many of the security features and add-ons found in modern PHP versions. Lerdorf later improved PHP/F1 1.0 and released it as PHP/FI 2.0, but it was only in 1997, when the developers Andi Gutmans and Zeev Suraski rewrote the PHP parser and released it as PHP 3.0, that the PHP movement really began to pick up steam. Not only was PHP 3.0’s syntax more powerful and consistent, but it also introduced a new, extensible architecture that encouraged independent developers to create their own enhancements and extensions to the language. Needless to say, this only encouraged adoption of the language, and it wasn’t long before PHP 3.0 began appearing on many thousands of Web servers.
The next iteration of the code tree, PHP 4.0, was released in 2000. It offered a new
engine, better performance and reliability, and built-in support for sessions and objectoriented features. A Nexen survey in July 2007 revealed that this version of PHP, PHP 4.x, was still the dominant version in use on the Internet’s Web sites, accounting for almost 80 percent of the PHP-capable servers surveyed. However, in July 2007, the PHP
development team announced that PHP 4.x would no longer be supported after December
2007, paving the way for more widespread adoption of newer versions
Advantages:
• Easy to learn: PHP has a short learning curve and programmers can quickly become productive. PHP was designed to appeal to Web designers and HTML coders, and they appreciate the ability to freely mix HTML and PHP. PHP allows them to easily and gradually add dynamic page generation features to their Web sites.
• Open Source: PHP is distributed under an Apache-style license that allows for both commercial and non-commercial use and development. This means that you can use it freely, without paying any licenses fees for machine, CPU, and so on. Also, there is a worldwide network of talented developers continuously improving and enhancing PHP. You can fix bugs or customize the software to your specific needs (or pay someone to do so) because the source code is available. This is not possible with commercial, off-the-shelf products.
• Community: PHP has a large base of users and developers. It is easy to find programmers fluent in the language. Many online resources are dedicated to PHP (Web sites, mailing lists, and so on) that provide valuable information and support.
• Database support: PHP provides extensive database support. It supports ODBC, open source databases such as MySQL and PostgreSQL, as well as commercial ones such as Microsoft SQL Server, Oracle, and Sybase.
• Multiplatform support: PHP runs on a variety of platforms and Web servers. PHP runs in most flavors of Unix and Windows as well as other OS such as Mac OS, OS X, or OS/2. PHP supports a wide variety of Web servers, ranging from the popular Apache, Microsoft IIS, and Netscape servers to less-known ones such as thttpd or AOLserver. This allows you to standardize on a common development language across a heterogeneous environment of systems and servers. You can build a solution with PHP on a specific platform/server/database combination and then migrate to a different combination gradually, replacing one component at a time. You can develop your code on a Windows workstation running IIS and deploy it on a Unix server running Apache with little or no changes.
• Extensions: PHP has a great number of available extensions and source code for everything from XML manipulation to directory access. Programmers can leverage this body of existing code to quickly put together advanced applications.
• Safe mode: PHP allows execution of code in restricted environments. This option is very attractive to ISP and Application Server Providers, which can offer PHP to their clients without compromising security. These providers often want to serve multiple customers using a shared infrastructure.
• Session support: Most Web applications require you to keep and manage state between requests. PHP offers native session management and an extension API so users can provide their own backend storage mechanisms.
• Rapid development: PHP gets compiled to an special bytecode format before getting executed. That step is completely transparent to programmers and users. Developers can make changes to a PHP page and see the results immediately in their browsers. By comparison, Java servlet development requires compile cycles and careful configuration of things such as class loaders, and so on.
• Commercial support: Several companies provide support and services around PHP, or bundle PHP as part of their server solution. Please refer to the resources at the end of this chapter to learn more about these companies. You should consider their services if you are using PHP in an enterprise environment, a mission critical Web site, or need custom features added to the language.
• It's Fun! PHP is an exciting language to program in. You can leverage existing extensions and code to quickly and easily put together great Web sites.
Disadvantages:
• Out of the box, PHP tends to execute more slowly than assembly, C, and other compiled languages
• PHP is loosely typed. For developers of all skill levels, this allows room for unexpected behavior due to programmer error that many other languages might not permit. [Of course, few if any languages can protect from developer error!]
• There are many ways to do one thing, and many cases where a function has ambiguous handling due to legacy support or PHP development history.
Conclusion
PHP is a great tool for writing dynamic web pages. Non-technical users can easily learn a few handy tricks to make their web pages easier to manage, and more useful.
Because its syntax resembles most C-like languages
When creating a PHP enhanced pages, there are a few things we must remember.
• PHP is a server-side technology, and does not work in a browser.
• The filename must have .php extension.
• PHP enhanced pages can contain a mixture of HTML and PHP code.
• PHP code must be enclosed in a <?php ?> tag.
.
PHP is a language used to develop interactive and dynamic content on the web and it is often used together with the Apache web server. It can also be used with Microsoft's IIS web server.
in this report included information on a variety of PHP topics including working with variables, working with strings, working with arrays and more.
For more PHP information and tips, please visit php.net.