Beginning PHP and MySQL - From Novice to Professional

von: W Jason Gilmore

Apress, 2008

ISBN: 9781430202998 , 1080 Seiten

3. Auflage

Format: PDF, OL

Kopierschutz: Wasserzeichen

Windows PC,Mac OSX geeignet für alle DRM-fähigen eReader Apple iPad, Android Tablet PC's Online-Lesen für: Windows PC,Mac OSX,Linux

Preis: 42,79 EUR

Mehr zum Inhalt

Beginning PHP and MySQL - From Novice to Professional


 

Contents at a Glance

5

Contents

7

About the Author

26

About the Technical Reviewers

27

Acknowledgments

28

Introduction

29

Download the Code

30

Contact Me!

30

Introducing PHP

31

History

32

General Language Features

37

Summary

40

Configuring Your Environment

41

Installation Prerequisites

42

Installing Apache and PHP on Linux

45

Installing Apache and PHP on Windows

47

Installing IIS and PHP on Windows

50

Testing Your Installation

53

Configuring PHP

55

Run- Time Configuration

57

Choosing a Code Editor

78

Choosing a Web Hosting Provider

80

Summary

83

PHP Basics

84

Embedding PHP Code in Your Web Pages

85

Commenting Your Code

88

Outputting Data to the Browser

90

PHP’s Supported Datatypes

94

Identifiers

102

Variables

102

Constants

115

Expressions

116

String Interpolation

124

Control Structures

127

Summary

141

Functions

142

Invoking a Function

142

Creating a Function

144

Function Libraries

153

Summary

154

Arrays

155

What Is an Array?

156

Creating an Array

157

Adding and Removing Array Elements

162

Locating Array Elements

164

Traversing Arrays

166

Determining Array Size and Uniqueness

171

Sorting Arrays

173

Merging, Slicing, Splicing, and Dissecting Arrays

181

Other Useful Array Functions

188

Summary

190

Object-Oriented PHP

191

The Benefits of OOP

192

Key OOP Concepts

194

Constructors and Destructors

210

Static Class Members

215

The instanceof Keyword

217

Helper Functions

217

Autoloading Objects

219

Summary

220

Advanced OOP Features

221

Advanced OOP Features Not Supported by PHP

222

Object Cloning

222

Inheritance

226

Interfaces

231

Abstract Classes

235

Introducing Namespaces

236

Summary

239

Error and Exception Handling

240

Configuration Directives

241

Error Logging

244

Exception Handling

248

Summary

256

Strings and Regular Expressions

257

Regular Expressions

258

Other String- Specific Functions

274

Alternatives for Regular Expression Functions

286

Taking Advantage of PEAR: Validate_ US

300

Summary

302

Working with the File and Operating System

303

Learning About Files and Directories

304

Working with Files

312

Executing Shell Commands

327

System- Level Program Execution

329

Summary

334

PEAR

335

Popular PEAR Packages

336

The Power of PEAR: Converting Numeral Formats

338

Installing and Updating PEAR

339

Using the PEAR Package Manager

342

Summary

348

Date and Time

349

The Unix Timestamp

349

PHP’s Date and Time Library

350

Date Fu

359

Date and Time Enhancements for PHP 5.1+ Users

371

Summary

374

Forms

375

PHP and Web Forms

375

Taking Advantage of PEAR: HTML_ QuickForm

381

Summary

390

Authenticating Your Users

391

HTTP Authentication Concepts

392

PHP Authentication

393

PHP Authentication Methodologies

396

User Login Administration

406

Summary

412

Handling File Uploads

413

Uploading Files via HTTP

413

Uploading Files with PHP

414

Taking Advantage of PEAR: HTTP_ Upload

421

Summary

425

Networking

426

DNS, Services, and Servers

427

Mail

436

Common Networking Tasks

443

Summary

449

PHP and LDAP

450

Using LDAP from PHP

452

Summary

468

Session Handlers

469

What Is Session Handling?

469

Configuration Directives

472

Working with Sessions

477

Practical Session- Handling Examples

482

Creating Custom Session Handlers

486

Summary

493

Templating with Smarty

494

What’s a Templating Engine?

495

Introducing Smarty

497

Installing Smarty

498

Using Smarty

500

Smarty’s Presentational Logic

502

Creating Configuration Files

516

Using CSS in Conjunction with Smarty

518

Caching

520

Summary

524

Web Services

525

Why Web Services?

526

Really Simple Syndication

528

SimpleXML

541

SOAP

548

Summary

559

Secure PHP Programming

560

Configuring PHP Securely

561

Hiding Configuration Details

567

Hiding Sensitive Data

570

Sanitizing User Data

571

Data Encryption

580

Summary

586

SQLite

587

Introduction to SQLite

587

PHP’s SQLite Library

591

Summary

610

Building Web Sites for the World

611

Translating Web Sites with Gettext

612

Localizing Dates, Numbers, and Times

618

Summary

620

MVC and the Zend Framework

621

Introducing MVC

621

PHP’s Framework Solutions

625

Introducing the Zend Framework

627

Summary

640

Introducing MySQL

641

What Makes MySQL So Popular?

642

The Evolution of MySQL

648

Prominent MySQL Users

651

Summary

653

Installing and Configuring MySQL

654

Downloading MySQL

655

Installing MySQL

655

Setting the MySQL Administrator Password

664

Starting and Stopping MySQL

665

Configuring and Optimizing MySQL

671

Configuring PHP to Work with MySQL

680

Summary

681

The Many MySQL Clients

682

Introducing the Command- Line Clients

682

MySQL’s GUI Client Programs

705

phpMyAdmin

710

Summary

711

MySQL Storage Engines and Datatypes

712

Storage Engines

712

Datatypes and Attributes

725

Working with Databases and Tables

737

Summary

747

Securing MySQL

749

What You Should Do First

750

Securing the mysqld Daemon

752

The MySQL Access Privilege System

752

User and Privilege Management

768

Limiting User Resources

777

Secure MySQL Connections

778

Summary

783

Using PHP with MySQL

785

Handling Installation Prerequisites

786

Using the mysqli Extension

788

Interacting with the Database

793

Executing Database Transactions

808

Summary

809

Introducing PDO

810

Another Database Abstraction Layer?

812

Using PDO

813

Summary

834

Stored Routines

835

Should You Use Stored Routines?

836

How MySQL Implements Stored Routines

837

Integrating Routines into Web Applications

861

Summary

863

MySQL Triggers

864

Introducing Triggers

864

MySQL’s Trigger Support

868

Integrating Triggers into Web Applications

874

Summary

876

MySQL Views

877

Introducing Views

878

MySQL’s View Support

879

Incorporating Views into Web Applications

890

Summary

892

Practical Database Queries

893

Sample Data

894

Creating Tabular Output with PEAR

894

Sorting Output

904

Creating Paged Output

906

Listing Page Numbers

909

Querying Multiple Tables with Subqueries

911

Iterating Result Sets with Cursors

916

Summary

920

Indexes and Searching

921

Database Indexing

921

Forms-Based Searches

933

Summary

938

Transactions

939

What’s a Transaction?

939

MySQL’s Transactional Capabilities

940

A Sample Project

942

Building Transactional Applications with PHP

947

Summary

951

Importing and Exporting Data

952

Sample Table

953

Using Data Delimitation

953

Importing Data

954

Exporting Data

964

Summary

968

Index

969