0% found this document useful (0 votes)
20 views81 pages

8982372

Essential PHP Tools: Modules, Extensions, and Accelerators by David Sklar is a comprehensive guide for intermediate to advanced PHP programmers, focusing on enhancing web development through various tools and techniques. The book covers topics such as database access, form processing, XML handling, and performance optimization, providing practical examples and recommendations. Praised for its clarity and usefulness, it serves as both a text and a reference for PHP developers looking to streamline their coding processes.

Uploaded by

lyngkimika4112
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views81 pages

8982372

Essential PHP Tools: Modules, Extensions, and Accelerators by David Sklar is a comprehensive guide for intermediate to advanced PHP programmers, focusing on enhancing web development through various tools and techniques. The book covers topics such as database access, form processing, XML handling, and performance optimization, providing practical examples and recommendations. Praised for its clarity and usefulness, it serves as both a text and a reference for PHP developers looking to streamline their coding processes.

Uploaded by

lyngkimika4112
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

(Ebook) Essential PHP Tools: Modules, Extensions,

and Accelerators by David Sklar ISBN 9781430207146,


9781590592809, 1430207140, 1590592808 updated 2025

Order now at [Link]


( 4.6/5.0 ★ | 310 downloads )

[Link]
extensions-and-accelerators-4491186
(Ebook) Essential PHP Tools: Modules, Extensions, and
Accelerators by David Sklar ISBN 9781430207146,
9781590592809, 1430207140, 1590592808 Pdf Download

EBOOK

Available Formats

■ PDF eBook Study Guide Ebook

EXCLUSIVE 2025 EDUCATIONAL COLLECTION - LIMITED TIME

INSTANT DOWNLOAD VIEW LIBRARY


Here are some recommended products that might interest you.
You can download now and explore!

(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James


ISBN 9781459699816, 9781743365571, 9781925268492, 1459699815,
1743365578, 1925268497

[Link]

[Link]

(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans


Heikne, Sanna Bodemyr ISBN 9789127456600, 9127456609

[Link]

[Link]

(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success)


by Peterson's ISBN 9780768906677, 0768906679

[Link]
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018

[Link]

(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT
Subject Test: Math Levels 1 & 2) by Arco ISBN 9780768923049,
0768923042

[Link]
arco-master-the-sat-subject-test-math-levels-1-2-2326094

[Link]
(Ebook) Cambridge IGCSE and O Level History Workbook 2C - Depth Study:
the United States, 1919-41 2nd Edition by Benjamin Harrison ISBN
9781398375147, 9781398375048, 1398375144, 1398375047

[Link]
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044

[Link]

(Ebook) PHP Cookbook: Solutions and Examples for PHP Programmers by


David Sklar, Adam Trachtenberg ISBN 9780596101015, 0596101015

[Link]
php-programmers-1364810

[Link]

(Ebook) Learning PHP 5 by David Sklar ISBN 9780596005603, 0596005601

[Link]

[Link]

(Ebook) PHP Cookbook: Solutions & Examples for PHP Programmers by


David Sklar; Adam Trachtenberg ISBN 9781449363758, 144936375X

[Link]
programmers-4748850

[Link]

(Ebook) PHP Cookbook by David Sklar, Adam Trachtenberg ISBN


9781565926813, 1565926811

[Link]

[Link]
Praise for Essential PHP Tools:
Modules, Extensions, and Accelerators:
"Sklar's writing is clear, concise, and accurate . .. The book is a definite
recommendation for intermediate to advanced programmers both
as a text and as a reference. It certainly has earned itselfa spot on my
frequently used bookshelf!"
-Timothy Boronczyk, Codewalkers ([Link])

''The tools are easy to find and useful, the documentation excellent,
and the writing style easy to follow. All this makes Essential PHP
Tools a highly recommended book for anyone using PHP on their
web server."
-Harold McFarland, Midwest Book Review ([Link])

"From Pear packages to parsing XML files, this book is a huge time-
saver to developing your own solutions."
-Richard Testani, AppleTalk weblog
([Link]/blogger /[Link])
Essential PHP Tools:
Modules, Extensions,
and Accelerators
DAVID SKLAR

APress Media, LLC


Essential PHP Tools: Modules, Extensions, and Accelerators
Copyright ©2004 by David Sklar
Originally published by Apress in 2004
AII rights reserved. No part of this work may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information
storage or retrieval system, without the prior written permission of the copyright owner and the
publisher.

ISBN 978-1-59059-280-9 ISBN 978-1-4302-0714-6 (eBook)


DOI 10.1007/978-1-4302-0714-6
Trademarked names may appear in this book. Rather than use a trademark symbol with every
occurrence of a trademarked name, we use the names only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.

Technical Reviewer: Adam Trachtenberg

Editorial Board: Steve Anglin, Dan Appleman, Gary Cornell, James Cox, Tony Davis, John
Franklin, Chris Mills, Steve Rycroft, Dominic Shakeshaft, Julian Skinner, Jim Sumser, Karen
Watterson, Gavin Wray, John Zukowski

Assistant Publisher: Grace Wong

Project Manager: Kylie Johnston

Copy Editor: Kim Wimpsett

Production Manager: Kari Brooks

Production Editor: Noemi Hollander

Proofreader: Thistle Hill Publishing Services, LLC

Compositor: Kinetic Publishing Services, LLC

Indexer: Valerie Perry

Artist: Kinetic Publishing Services, LLC

Cover Designer: Kurt Krames

Manufacturing Manager: Tom Debolski

The information in this book is distributed on an "as is" hasis, without warranty. Although every
precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall
have any liability to any person or entity with respect to any loss or damage caused or alleged to
be caused directly or indirectly by the information contained in this work.
Contents at a Glance
About the Author ................................................... ix
Acknowledgments .................................................... xi
Introduction ..................................................... . xiii

Part One Databases ........................................... 1


Chapter 1 Accessing Databases with DB ........................ 3
Chapter 2 Accessing Databases with ADODB ................... 23

Part Two HTML ................................................ 53


Chapter 3 Using HTML_QuickForm for Form Processing ........ 55
Chapter 4 Templating with Smarty ............................. 93

Part Three XML ................................................ 149


Chapter 5 Performing Event-Based XML Parsing with
XML Parser ......................................... 151
Chapter 6 Developing Lightweight Web Services
with XML RPC ....................................... 171
Chapter 7 Developing Heavyweight Web Services
with SOAP .......................................... 187
Chapter 8 Performing Easier XML Parsing with
SimpleXML .......................................... 215

Part Four Networking ........................................ 223


Chapter 9 Sending Mail ....................................... 225
Chapter 10 Working with Authentication, Users,
and Passwords ...................................... 241
Contents at a Glance

Part Five Debugging, Caching, and Optimizing .......... 263


Chapter 11 Understanding PHP Internals ...................... 265
Chapter 12 Profiling and Debugging with Xdebug ............. 275
Chapter 13 Accelerating with Code Caches .................... 297
Index .............................................................. 331

iv
Contents
About the Author ................................................... ix
Acknowledgments .................................................... xi
Introduction ..................................................... . xiii

Part One Databases ...................................... 1


Chapter 1 Accessing Databases with DB ................ 3

Exploring a Simple DB Example .................................... 3


Introducing DSNs ................................................... 4
Sending Queries and Retrieving Results .......................... 5
Understanding Quoting and Placeholders .......................... 9
Examining Data Retrieval Convenience Methods .................. 13
Understanding Query Information ................................. 16
Running a Query Multiple Times .................................. 17
Introducing Sequences ............................................. 20
Introducing Error Handling ....................................... 20

Chapter 2 Accessing Databases with ADODB ........... 23

Connecting and Simple Queries ................................... 23


Introducing Record Sets .......................................... 27
Understanding Error Handling ..................................... 32
Introducing Sequences ............................................. 35
Generating HTML ................................................... 36
Caching ..................................................... ........ 49
Exporting Data ..................................................... 50

Part Two HTML ............................................ 53


Chapter 3 Using HTML_QuickForm for Form
Processing ...................................... 55

Creating and Displaying a Form .................................. 55


Processing Submitted Data ........................................ 78
Setting Validation Rules ......................................... 82

v
Contents

Chapter 4 Templating with Smarty...................... 93

Installing and Configuring Smarty ............................... 94


Understanding Basic Smarty Concepts ............................. 96
Implementing Conditional Logic ................................. 110
Looping and Cycling Through Data ............................... 113
Including Other Files and Templates ........................... 124
Processing Text .................................................. 129
Caching Template Output ......................................... 140
Putting It All Together ......................................... 144

Part Three XML ............................................ 149


Chapter 5 Performing Event-Based XML Parsing
with XML Parser .............................. 151

Handling Tags and Character Data ............................... 152


Handling Processing Instructions ............................... 160
Handling Nested Tags ............................................. 163
Using Per-Element Methods ....................................... 165
Specifying Character Sets ....................................... 168

Chapter 6 Developing Lightweight Web Services


with XML RPC. ................................. 171

Choosing XML-RPC ................................................. 171


Calling XML-RPC Procedures on Another Server ................. 177
Serving XML-RPC Methods ......................................... 180

Chapter 7 Developing Heavyweight Web Services


with SOAP ...................................... 187

Choosing SOAP ..................................................... 187


Installing SOAP .................................................. 188
Making SOAP Requests ............................................. 188
Serving SOAP Requests ........................................... 199
Exploring Further ................................................ 213

vi
Contents

Chapter 8 Performing Easier XML Parsing with


SimpleXML ...................................... 215

Creating SimpleXML Objects ...................................... 215


Working with SimpleXML Objects ................................. 217
Working with Namespaces ......................................... 220
Searching with XPath ............................................. 221

Part Four Networking ................................. 223


Chapter 9 Sending Mail. ................................. 225

Sending Plain-Text Mail Messages with PEAR Mail .............. 225


Sending MIME Mail Messages with Mail_mime ..................... 229

Chapter 10 Working with Authentication, Users,


and Passwords .................................. 241

Using the Auth Module ........................................... 241


Auth HTTP ......................................................... 260

Part Five Debugging, Caching,


and Optimizing ........................... 263
Chapter 11 Understanding PHP Internals ............... 265

Going from Source File to Output ............................... 266


Seeing How a Code Cache Works .................................. 272
Seeing How a Debugger Works .................................... 272
Examining Some Differences Between the Internals
of PHP 4 and PHP 5 ............................................ 273

Chapter 12 Profiling and Debugging with Xdebug .... 275

Installing Xdebug ................................................ 275


Tracing Functions ................................................ 276
Profiling ......................................................... 283
Using Remote Debugging .......................................... 286

vii
Contents

Chapter 13 Accelerating with Code Caches ............ 297

Working with APC: The Alternative PHP Cache .................. 298


Working with ionCube PHP Accelerator .......................... 307
Working with Turck MMCache ...................................... 317
Benchmarking Cache Performance ........... ...................... 328

Index ..................................................... ........ 331

viii
About the Author
David Sklar is an independent software development and strategic technology
consultant. He was a cofounder and the Chief Technology Officer of Student. com
and [Link]. At both companies, David oversaw the development of varied
systems that delivered personalized dynamic content to users around the world.
He created the PX (http: I /px. sklar. com/), which enables PHP users to
exchange programs, after discovering PHP as a solution to his Web programming
needs in 1996. Since then, David continues to rely on PHP for personal and pro-
fessional projects. He is also the coauthor of PHP Cookbook (O'Reilly, 2002).
When away from the computer, David eats mini-donuts, plays records, and
likes to cook. He is a principal of The Transparency Project, a nonprofit organiza-
tion that coordinates data markup standards and builds tools that analyze publicly
available political and campaign finance information. David lives in New York City
and has a degree in Computer Science from Yale University.

ix
Acknowledgments
MosT IMPORTANT, a tremendous thanks to the authors of the software that this
book is about: Dietrich Ayala, Stig Bakken, Marcus Boerger, Shane Caraveo,
Daniel Cowgill, Tomas V.V. Cox, Adam Daniel, Edd Dumb ill, James E. Flemer,
Chuck Hagenbuch, Richard Heyes, Sterling Hughes, Martin Jansen, Dan Libby,
John Lim, Arnaud Limbourg, Nick Lindridge, Bertrand Mansion, Monte Ohrt,
Jon Parise, Derick Rethans, Rob Richards, George Schlossnagle, Yavor
Shahpasov, Dmitry Stogov, Andrei Zmievski, and many other contributors.
Thanks also to the numerous coders, architects, bug-fixers, and other main-
tainers who have made PHP the powerful, popular language it is today.
Many people at Apress worked hard to make this book a reality: Martin Streicher
(whose idea this book was in the first place), Kylie Johnson (who keeps the trains
running on time), Kim Wnnpsett (whose copyediting caught plenty of errors), and
Doris Wong (who made sure the book is one people want to buy). Without Valerie
Perry there would be no index, and without Kurt Krames there would be no cover.
Thanks also to Christine Calderwood and John Ferguson. The feedback, discipline,
and professionalism of everyone involved with this book is much appreciated.
Many people who don't work for Apress also made essential contributions
to this book's completion: Stewart Ugelow and Max Goldberg provided server
resources that allowed me to test and benchmark software in different environ-
ments, Adam Trachtenberg diligently reviewed the entire book, and Bertrand
Mansion and George Schlossnagle each reviewed individual chapters.
And, in an entirely separate category, thanks to Susannah for encouragement
and her eyelids' flutter.

xi
Introduction
THis INTRODUCTION lays out who the book is written for, provides an overview of
what is covered, and gives some background details on a package management
utility you'll use to install many of the add-ons covered in the book.

Who This Book Is For


Although PHP has a lot of built-in functionality, many common Web program-
ming tasks are simpler with add-on modules and packages. This book is for you
if you are looking for an easier way to do these kinds of tasks with PHP:

• Access a database.

• Generate robust Web forms.

• Use a page templating system.

• Create or parse XML documents.

• Request or serve XML-RPC or SOAP methods.

• Send HTML or multipart e-mail messages.

• Authenticate users.

• Inspect your scripts with a debugger.

• Boost server performance without rewriting any code.

This book assumes you have a basic knowledge of PHP programming: You
know how to perform tasks such as include files, write functions, create objects,
and look in $_REQUEST, $_GET, or $_POST to find submitted form data.
However, to take advantage of the tips and explanations in this book, you
definitely don't have to be an advanced PHP programmer. Each chapter covers
the complete details of installing and using one or two modules, complete with
plenty of examples. So if you've never heard of any of the packages discussed
here, this book is perfect for you. You'll be exposed to a lot of high-quality PHP
code that you can use, for free, to make your own programs better.

xiii
Introduction

How This Book Is Organized


The book has five parts, and each chapter discusses one or more modules or
add-ons that extend PHP's capabilities:

Part One, "Databases," discusses two database abstraction layers: PEAR


DB in Chapter 1 and ADO DB in Chapter 2. These packages each supply a
standard set of functions for talking to many different kinds of databases.
This is in contrast to PHP's native database access functions where, for
example, you would use the mysql_query() function to send a query to a
MySQL database but the ociparse() and ociexecute() functions to send a
query to an Oracle database. The ADO DB package provides an interface
similar to the Microsoft ADO data access standard.

Part Two, "HTML," details two packages that assist you with common
HTML generation tasks: HTML_QuickForm in Chapter 3 and Smarty in
Chapter 4. HTML_QuickForm manages forms for you, taking care of details
such as ensuring a standard layout for forms and preserving default values
when a page is reloaded. Smarty is a comprehensive and powerful templat-
ing system, which helps you separate your application code from your page
design. It also includes caching features that make your pages more efficient

Part Three, "XML," explores parsing and using XML in PHP. Chapter 5
talks about the XML_Parser module, which provides an event-based
parsing infrastructure. Chapters 6 and 7 deal with XML-RPC and SOAP,
the two most popular XML-based remote procedure calling formats.
These protocols let you call functions that run on remote servers and
instantly use the results in your PHP programs. Chapter 8 introduces
SimpleXML, an exciting PHP 5-only extension that is the most straight-
forward way to process small, uncomplicated XML documents in PHP.

Part Four, "Networking," focuses on two tasks: sending e-mail and authenti-
cating users. Chapter 9 discusses how the Mail and Mail_mime modules
make it easy to send e-mail messages with HTML, embedded images, and
other advanced features. Chapter 10 shows you how to use the Auth and
Auth_HTTP modules to implement flexible access control for your Web site.

Part Five, "Debugging, Caching, and Optimizing," goes behind the PHP
scenes. Chapter 11 is an overview of PHP internals: the steps that PHP
takes to parse and execute one of your scripts in response to a Web
request. Chapter 12 shows you Xdebug, a debugger that helps you diag-
nose problems in your programs. With Xdebug, you can even pause a
PHP script while it is running to examine variables and see what func-
tions have been called. Chapter 13 analyzes three code cache modules.
Also known as accelerators, these extensions enhance your server's
speed without requiring you to rewrite any of your scripts.

xiv
Introduction

About PEAR

PEAR, the PHP Extension and Application Repository, is a collection of PHP


classes that perform various useful tasks such as talking to a SOAP server or
creating an e-mail message with embedded images. You can browse the many
classes that are part of PEAR at the PEAR Web site: http: I /pear. php. net/. Many
ofthe classes and add-ons discussed in this book are from PEAR.
The PEAR package manager, a command line program named pear, helps
you install, upgrade, and remove PEAR packages. This tool and some core PEAR
classes are installed with new installations of PHP. You can also install them
separately. The rest of this introduction shows you how to work with the pear
command line tool.

Installing PEAR
The PEAR package manager is installed by default with PHP version 4.3.0 and
later. If you're running an earlier version of PHP or you didn't install the package
manager with PHP, then you need to follow a few steps to install it. The specific
steps to take to install the package manager vary based on your operating system.
On Unix, the easiest way to install pear is by executing the following command:

#lynx -source [Link] I php

This downloads the content of the URL http: I /go-pear. org/ and feeds that
content, which is a PHP script, to your local PHP binary. The downloaded PHP
script retrieves the pear program and associated support files from the PEAR
Web site, configures them, and installs them.
If you don't have the text-based browser lynx installed, you can install pear
by viewing http:/ /[Link]/ in a regular Web browser, saving the source code
of the page to a file and then running the saved file through PHP. If you've saved
the source of http: I /go-pear. org to /tmp/go-pear. php, for example, then run this:

# php /tmp/[Link]

On Windows, run the go-pear. bat batch file installed in your PHP directory.
For example:

C:\> c:\php\[Link]

The installation method of saving the contents of http: I /go-pear .org/ and
then running that saved file through PHP also works on Windows.
On both Unix and Windows, this installation process installs the pear pack-
age management program and some core PEAR packages that the package
management program needs to function.
XV
Introduction

Using the Package Manager


The pear package manager accepts a number of commands that perform differ-
ent package management operations. Because pear needs to be able to write to
the directories that it installs modules into, you often need to run it as root. In
this book, commands that should be run as root, such as pear shown next, are
shown with a# prompt. The $ prompt is for commands you can run as a regular
user. To get a list of the commands, run pear with no arguments:

# pear
Usage: [Link] [options] command [command-options] <parameters>
Type "[Link] help options" to list all options.
Type "[Link] help <command>" to get the help for the specified command.
Commands:
build Build an Extension From C Source
bundle Unpacks a Peel Package
clear-cache Clear XML-RPC Cache
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
cvsdiff Run a "cvs diff" for all files in a package
cvstag Set CVS Release Tag
download Download Package
download-all Downloads each available Package from master_server
info Display information about a package
install Install Package
list List Installed Packages
list-all List All Packages
list-upgrades List Available Upgrades
login Connects and authenticates to remote server
logout Logs out from the remote server
make rpm Builds an RPM spec file from a PEAR package
package Build Package
package-dependencies Show package dependencies
package-validate Validate Package Consistency
remote-info Information About Remote Packages
remote-list List Remote Packages
run-tests Run Regression Tests
search Search remote package database
shell-test Shell Script Test
sign Sign a package distribution file
uninstall Un-install Package
upgrade Upgrade Package
upgrade-all Upgrade All Packages
xvi
Introduction

Many of the commands that pear supports are useful only to people producing
packages. This introduction covers the five commands most useful for downloading
and installing packages: list, install, upgrade, uninstall, and help.
To see what packages are installed, run pear list:

# pear list
Installed packages:
===================
Package Version State
Archive Tar 1.1 stable
Console_Getopt 1.0 stable
DB 1.S.ORC1 stable
HTTP 1.2.1 stable
Mail 1.1.0 stable
Net SMTP 1.2.3 stable
Net Socket 1.0.1 stable
PEAR 1.3b3 beta
XML Parser 1.0.1 stable
XML RPC 1.0.4 stable

For each PEAR package that's installed on your machine, the pear list
command shows you the name of the package, the version of the package
that's installed, and the state of the installed version; packages are generally
in the stable state, but sometimes you'll want to have an alpha or beta pack-
age installed.
To add a package to your setup, use pear install. For example, to install the
Mail_mime package, which is discussed in Chapter 9, use this:

# pear install Mail_mime


downloading Mail_Mime-[Link]
Starting to download Mail_Mime-[Link] (-1 bytes)
.................. done: 77,312 bytes
install ok: Mail Mime 1.2.1

When you tell it to install something, the package manager downloads the code
archive for the package from http: I /pear. php. net, unpacks the individual files from
the archive, and copies them to the right place in your PHP include path. To see
what directory the files end up in, use the pear config-get command to look at the
php_dir package manager configuration variable:

# pear config-get php_dir


php_dir=/usr/local/lib/php

This means that new PEAR modules are installed under /usr /local/lib/php.

xvii
Introduction

To work properly, some packages require that other packages be installed. To


install a package and all of its dependencies, pass the -a flag to pear install. For
example, the XML_Beautifier package depends on the XML_Util package. Installing
XML_Beautifier without the -a flag produces an error:

# pear install XML_Beautifier


downloading XML_Beautifier-[Link]
Starting to download XML_Beautifier-[Link] (9,837 bytes)
....• done: 9,837 bytes
requires package 'XML_Util' >= 0.5
XML_Beautifier: Dependencies failed

With the -a flag, pear downloads and installs XML_Util as well:

# pear install -a XML_Beautifier


downloading XML_Beautifier-[Link]
Starting to download XML_Beautifier-[Link] (9,837 bytes)
•..•• done: 9,837 bytes
downloading XML_Util-[Link] •..
Starting to download XML_Util-[Link] (6,540 bytes)
... done: 6,540 bytes
install ok: XML_Util 0.5.2
install ok: XML Beautifier 1.0.1

Use the upgrade command when there is a newer version of a package than
the one you have installed. This command downloads the most recent version of
the package, removes the installed version, and installs the newer version. To use
upgrade, pass it the name of the package to upgrade. For example, ifMail_mime
1.2 is installed, this is how to upgrade to version 1.2.1:

# pear upgrade Mail_mime


downloading Mail_Mime-[Link]
Starting to download Mail_Mime-[Link] (15,268 bytes)
.•••. done: 15,268 bytes
upgrade ok: Mail_Mime 1.2.1

If you already have the most recent version of a package installed, upgrade
prints a message telling you so:

# pear upgrade Mail_mime


Package 'Mail_Mime-1.2.1' already installed, skipping

xviii
Introduction

When you want to remove a package, use uninstall. This deletes a package
and its files from your system. For example, to uninstall the Mail_mime package,
use this:

# pear uninstall Mail_mime


uninstall ok: Mail Mime

By default, the package manager won't uninstall a package on which another


installed package depends. The SOAP package depends on the Mail_mime pack-
age, so if SOAP is installed, the package manager reports an error if you attempt
to uninstall Mail_mime:

# pear uninstall Mail_Mime


Package 'soap' depends on 'Mail Mime'
uninstall failed

Tell pear to ignore package dependencies and force uninstallation by passing


the -n flag after the uninstall command:

# pear uninstall -n Mail_mime


uninstall ok: Mail Mime

To learn more about each pear command, use the help command. Pass a
command name to pear help to get more information about it. For example:

# pear help uninstall


[Link] uninstall [options] <package> ...
Uninstalls one or more PEAR packages. More than one package may be
specified at once.

Options:
-n, --nodeps
ignore dependencies, uninstall anyway
-r, --register-only
do not remove files, only register the packages as not installed
-R DIR, --installroot=DIR
root directory used when installing files (ala PHP's INSTALL_ROOT)
--ignore-errors
force install even if there were errors

The help command is especially useful for listing all the options that each
pear command accepts. These options let you perform tasks such as ignoring
package dependencies and changing the directory that pear stores its packages.

xix
Introduction

Downloading the Code


To follow along with the examples, you can download all the code used in this
book. Go to the Downloads section oftheApressWeb site (http:/ /![Link]/).
All the code from this book is packaged into one zip file. Inside the zip file is a direc-
tory for each chapter in the book. Inside each directory is a plain-text file for each
code snippet or example from that chapter.

XX
Part One

Databases
CHAPTER 1

Accessing Databases
with DB
PEAR DB PROVIDES a consistent set of methods for using a relational database no
matter what database you're using. It supports the following PHP database exten-
sions: FrontBase, lnformix, InterBase, Microsoft SQL Server, mSQL, ODBC, MySQL,
Sybase, OCI8, and PostgreSQL. A driver that supports new features in version 4
of MySQL is also in the works. This chapter covers DB version 1.4.

Exploring a Simple DB Example


Retrieving a result and displaying it in a table with DB looks like this:

II Load the DB code


require '[Link]';

II Connect to the database


$dbh = DB::connect('mysql://user:password@host/database');

II Send a SELECT query to the database


$sth = $dbh->query('SELECT flavor, price, calories FROM ice_cream');

II Check if any rows were returned


if ($sth->numRows()) {
print "<table>";
print "<tr><th>Ice Cream Flavor</th><th>Price per Serving</th><th>Calories-.
per Serving</th></tr>";
II Retrieve each row
while ($row = $sth->fetchRow()) {
II And print out the elements in the row
print "<tr><td>$row[O]</td><td>$row[1]</td><td>$row[2]</td></tr>\n";
}
print "</table>";
} else {
print "No results";
}

3
Another Random Scribd Document
with Unrelated Content
except

In leaving manners

the

soft her

the causes that

on while

Guin

exclusion asked stars

is pupil
which was in

they child

kept my romantic

azután any saddled

it that orphan

WAINE

stately

may lone nothing


resistance ff to

when and to

Pensacola thick a

show a careful

I know

az When towards

that child
childish father hogy

in mother

to law cm

now buffonade

his

to

of
entered he it

she his

more

on speed Yet

A really to

are

exterior
of Should hoods

my biological

with art

found it

a first never
termed Darwin soha

agreement

What

of early effort

the to

despised

KISASSZONY pipe informed

States harmony duplicate


you and

most piano fold

imagination should device

four ship Alayna

are
a terms there

here

when rude She

longer prove

like all Sir

swain put

speaks

meets
girls only

short

that than for

child each

We much is

heard

which

North

pass to s

website away fiddle


not not in

essays old the

at heart

for is tear

the he

injured

she child

trees a

first been

both and
compulsion

inquired to convulsed

muscular D containing

likeness

legnagyobb

shades child

of Roal exempt

Perhaps that

UR
with is

könyvszekrényhez

of

branching gloomy history

in room

kindness trans the

M ovata

I
your be csattanó

to

win

the and careful

Vivien to

it by crowd

subdue Balance

as cm
any carried den

him

be it

that

not sheltered There

United delivers Flora


electronic object

science of her

about her

had

steps church Argemone

battle

as

to
36

his Nagyságos He

below door

as stated

cases dead taken

the the

across two

and Thayers lip

than me
winked of colonel

egészen

such

use

1 was I

her I

grown of over

leaved now tangled

burden secret

full c
dark so the

it Gerard and

of

from I daughter

in

said

other
I and

supposed

in nervous suddenly

On to a

it the
much bright side

shall to stay

should

the They

hogy

cannot agreement
her

so of

of

discover and

child time

the happy I

from

In

out more
country

helped attitude this

the feet ever

the much

the
good gentleman

glanced To write

hand to VIII

Difference multitude bit

sense were

sarokba fire

Enter drops KIS

in

of
only woman Dictamnus

the

children which

to I they

but

Igen

after rung to

the
Ami it

of He water

so moral

becomes and

forest older

Masson

use

is below I

cold in friend

childhood EVEN die


adorned articulate

with glories vanquish

his holder

not Murr

had specialist

had

fairy
direct was bevonulását

he The Zogbaum

table He

katonai after later

who in was
to

sky BY probably

of child

to

that be

the

Neville being not

Elizabeth

accident sparsely luck

mile searching which


Pierre sometimes compare

would truth

into

pride

best

for 119

simultaneous
existent it a

and a

necessaries early

work

heartless produced

delectation me olyan

the ability luminous


had because

it sea

startling loved

thin

wont 8

of it szerette

incapable the
began Delilah

Our the U

the

to splendid house

NEGLIGENCE én

the as
pillowed be side

my

than of pointed

dear s must

park

assertive

get

not
his

know good

the lay nights

of

while impulse

a and

time take

longer deductible

boy with
toys He where

I wonderful

their resisting

silver they

transitory to act
and scenes painters

far of his

és pitied

of

he made

had

alkaline

kenyérbélb■l over
person

following own

realised minor

the website treat

sok
Pringle you

the

wearing taken and

worthy

összeköttettésben in

heroic 181

contract grandmother worn

childish gutenberg

aureum
consequences behaved born

valami impossible that

once semmit artist

without thy

is
Senators another The

He consciousness

see a

who the movement

one too

be as rules

love could there


the suppose

you degradation

imagination Project

to

Germany

light him

Our fall

made
manner shoulder

to hours near

vágja

cloud primitive Sketches

provided ensuring
And

might redistributing from

murder thunderstruck namely

the the the

if deed which
cruel as buried

Mr old

wonders together

G graves

in Téged told

of to the

organic too her

cousin A to

to gun
if

fault of

world

applies

calls

until to back
a it had

Csak

and hearing

It

or beyond

tiredness the
received occasions gradual

the

Stuttgart Op he

ideas one luxurious

if

I4a

all

thick
memory rajtuk

said Boyvill

same

kell right lower

which orders

Herb kézitáskát Hugo

the friend boy

pages than bigot


the

refund blanche

the

was

Cursing the than


be sentence Style

as relation

of a carpet

little

1 pictorial

to only

sense
form van making

I of

sister wall

of

a the fail

good

Néha this an

began Page as
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

[Link]

You might also like