PHP (recursive acronym for “PHP: Hypertext Preprocessor”) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML and efficient alternative to competitors such as Microsoft’s ASP.
Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain HTML with embedded code that does “something”. The PHP code is enclosed in special start and end processing instructionsthat allow you to jump into and out of “PHP mode.”
What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, generating HTML which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was. You can even configure your web server to process all your HTML files with PHP, and then there’s really no way that users can tell what you have up your sleeve.
PHP is that the language interfaces very well with MySQL a popular type of online database. MYSQL is a commercial grade database application that is made available free under the Open Source to anyone. PHP and MySQL are excellent choice for webmasters looking to automate their web sites . Now search spiders “see” all the content on a PHP page, the same way it is viewed in a browser. The creation of a php-shopping cart is surprisingly simple and when done with precision it could translate into a highly effective and universally accepted php-shopping cart.
Why PHP?
- PHP runs on different platforms (Windows, Linux, Unix, etc.)
- PHP is compatible with almost all servers used today (Apache, IIS, etc.)
- PHP is FREE to download and use
- PHP is easy to learn and runs efficiently on the server side
- PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
Characteristics of PHP
As you may have realized, the PHP language revolves around the central theme of practicality. PHP is about providing the programmer with the necessary tools to get the job done in a quick and efficient fashion. Five important characteristics
make PHP practical nature possible:
- Familiarity
- Simplicity
- Efficiency
- Security
- Flexibility
Familiarity
Programmers from many backgrounds will find themselves already accustomed to the PHP language. Many of the language constructs are borrowed from C and Perl, and in many cases PHP code is almost indistinguishable from that found in the typical C or Pascal program. This minimizes the learning curve considerably.
Simplicity
A PHP script can consist of 10,000 lines or one line: whatever you need to get the job done. There is no need to include libraries, special compilation directives, or anything of the sort. The PHP engine simply begins executing the code after the first escape sequence ( (?>). If the code is syntactically correct, it will be executed exactly as it is displayed.
Efficiency
Efficiency is an extremely important consideration for working in a multiuser environment such as the WWW. PHP 4.0 introduced resource allocation mechanisms and more pronounced support for object-oriented programming, in addition to session management features. Reference counting has also been introduced in the latest version, eliminating unnecessary memory allocation.
Security
PHP provides developers and administrators with a flexible and efficient set of security safeguards. These safeguards can be divided into two frames of reference: system level and application level.
System-Level Security Safeguards
PHP furnishes a number of security mechanisms that administrators can manipulate, providing for the maximum amount of freedom and security when PHP is properly configured. PHP can be run in what is known as safe mode, which can limit users attempts to exploit the PHP implementation in many important ways. Limits can also be placed on maximum execution time and memory usage, which if not controlled can have adverse affects on server performance. Much as with a cgi-bin folder, administrators can also place restrictions on the locations in which
users can view and execute PHP scripts and use PHP scripts to view guarded server information, such as the passwd file.
Application-Level Security Safeguards
Several trusted data encryption options are supported in PHP predefined function set. PHP is also compatible with many third-party applications, allowing for easy-integration with secure ecommerce technologies. Another advantage is that the PHP source code is not viewable through the browser because the script is completely parsed before it is sent back to the requesting user. This benefit of PHP server-side architecture prevents the loss of creative scripts to users at least knowledgeable enough to execute a View Source. Security is such an important issue that this book contains an entire chapter on the subject. Please read Chapter 16, Security,for a thorough accounting of PHP security features.
Flexibility
Because PHP is an embedded language, it is extremely flexible towards meeting the needs of the developer. Although PHP is generally touted as being used in conjunction solely with HTML, it can also be integrated alongside languages like JavaScript, WML, XML, and many others. Additionally, as with most other mainstream languages, wisely planned PHP applications can be easily expanded as needed. Browser dependency is not an issue because PHP scripts are compiled entirely on the server side before being sent to the user. In fact, PHP scripts can be
sent to just about any kind of device containing a browser, including cell phones, personal digital assistant (PDA) devices, pagers, laptops, not to mention the traditional PC. People who want to develop shell-based applications can also execute PHP from the command line. Since PHP contains no server-specific code, users are not limited to a specific and perhaps unfamiliar Web server. Apache, Microsoft IIs, Netscape Enterprise Server, Stronghold, and Zeus are all fair game for PHP server integration. Because of the various platforms that these servers operate on, PHP is largely platform independent, available for such platforms as UNIX, Solaris, FreeBSD, and Windows 95/98/NT.
Finally, PHP offers access to external components, such as Enterprise Java Beans and Win32 COM objects. These newly added features put PHP in the big league, truly enabling developers to scale PHP projects upward and outward as need be.















