PHP 4 Developer's Guide

PHP 4 Developer's Guide

PHP 4 Developer's Guide

PHP 4 Developer's Guide

Paperback

$73.00 
  • SHIP THIS ITEM
    Qualifies for Free Shipping
  • PICK UP IN STORE
    Check Availability at Nearby Stores

Related collections and offers


Overview

*PHP--a server-side, embedded HTML scripting language--is used to develop dynamic Web content.
* Hot language--Red Hat and Mitsubishi are among the companies that use PHP as their Web development solution. It's also the most popular Apache module.
* This book provides the tools and information needed to build dynamic Web applications and databases with PHP 4.
* Covers installation, configuration, database connectivity, working with XML and CGL, and much more.
* Includes details on the new features in PHP 4, including shared memory support, the new Zend engine, and XML support.

Product Details

ISBN-13: 9780072127317
Publisher: McGraw-Hill Companies, The
Publication date: 01/01/2001
Series: Application Development
Pages: 800
Product dimensions: 7.50(w) x 9.25(h) x 1.59(d)

Read an Excerpt

Chapter 1: Building and Installing PHP4

Introduction

Before delving into the language, it is important to first get PHP installed and running in your environment. Because PHP supports so many Web servers and operating systems, this chapter focuses on providing detailed examples of installing on only a few platforms, while providing enough information so that you can tweak the examples to your specific platform.

The platforms that are discussed in depth in this chapter are Apache on Linux and IIS/PWS on Windows NT. These are common Web server configurations and are different enough to illustrate the required concepts for installing PHP on most platforms. Platform-specific details can also be found at the PHP site, wwwphp.net.

Downloading PHP

Obviously, the first step in beginning with PHP is to download it. The download section at www.php.net provides several download options. The most current version of PHP is listed at the top of the downloads page. For a *nix server, it is recommended that you download the complete source code and build PHP yourself. The term *nix refers to any Unix-like platform, including Linux, BSD, Solaris, and others. For Windows, it is recommended that you download the binary version of PHP.

From the download page, you can also download a previous version of PHP, the documentation, and related PHP tools. You may want to download a previous version of PHP if you already have PHP code running elsewhere and don't want to risk incompatibilities.

Installing the Binary Version

Once you have obtained a binary distribution of PHP, installation is straightforward. The most common binary installation of PHP is theWindows version. Because some *nix distributions may include a binary distribution of PHP, a brief installation discussion is included here as well.

Windows Binary Installation

With PHP, more than one option is always available for just about everything. The binary PHP download for Windows includes both the Common Gateway Interface (CGI) version of PHP and the ISAPI version. If you are running the Internet Information Server (IIS) or the Personal Web Server (PWS), it is recommended that you use the ISAPI version of PHP. The CGI version requires that the PHP executable be invoked for each page, so it is less efficient than using a dynamically linked library such as an ISAPI extension. The ISAPI version is also inherently more secure than the CGI version, so it is preferred.

Installing the PHP ISAPI Module If you are using IIS/PWS or another Windows-based Web server that supports ISAPI, then the best choice for security and scalability is to use the PHP ISAPI module. To install the ISAPI module, copy the php4ts.d11 and msvcrt.dll files into the Windows system directory (usually \ windows \ system on Windows 95 and \winnt\system32 on Windows NT). These files must be copied to the system directory for any version of PHP4 to work on Windows. They are shared libraries that must be available for PHP to work correctly. Additionally, you may copy the other DLL files to the system directory if you want, but they do not need to be moved to be used.

Next, IIS or PWS needs to be configured to use the ISAPI module when serving PHP files. This is done by starting the Microsoft Management Console for IIS configuration, which is typically available from the Windows NT Option Pack menu. Figure 1.1 shows the menu hierarchy for locating the application on Windows NT Once the Microsoft Management Console is running, right-click on your Web server node (probably labeled Default Web Site) and select Properties, as shown in Figure 1.2. Then on the Properties dialog, select the Home Directory tab and click the Configuration button. This enables you to add and edit extension mappings. Click the Add button and then enter the information requested. Figure 1.3 shows the process of adding the PHP ISAPI module as a mapping for files with the phtml extension.

Once you have added a mapping, the information appears in the Application Configuration dialog. Something that might be useful for testing is to have some extensions map to the PHP ISAPI module and some to the CGI executable...

Table of Contents

Chapter 1: Building and Installing PHP4.
Chapter 2: The Language.
Chapter 3: Forms and Cookies.
Chapter 4: Working with Files.
Chapter 5: Forms and File Uploading.
Chapter 6: Working with Databases.
Chapter 7: Sessions and Application State.
Chapter 8: Authentication.
Chapter 9: Browser Independence.
Chapter 10: Debugging.
Chapter 11: Code Reuse.
Chapter 12: Separating HTML from PHP.
Chapter 13: Cool PHP.
Chapter 14: Template-Based Web Site.
Chapter 15: Database-Driven Web Site.
Chapter 16: Generating Static HTML Pages from Dynamic Data.
Chapter 17: E-Commerce Web Sites.
From the B&N Reads Blog

Customer Reviews