PHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax Table Of Contents
Table of Contents
Preface
Chapter 1: Getting Started with PHP and Oracle
Chapter 2: PHP and Oracle Connection
Chapter 3: Data Processing
Chapter 4: Transactions
Chapter 5: Object-Oriented Approach
Chapter 6: Security
Chapter 7: Caching
Chapter 8: XML-Enabled Applications
Chapter 9: Web Services
Chapter 10: AJAX-Based Applications
Appendix A: Installing PHP and Oracle Software
Index
- Chapter 1: Getting Started with PHP and Oracle
- Why PHP and Oracle?
- Simplicity and Flexibility
- Performance
- Robustness
- Exploring PHP and Oracle Alternatives
- PHP and MySQL
- JSF and Oracle
- What You Need to Start
- Pieces of Software Required
- Oracle Database Considerations
- Understanding the Oracle Database
- Choosing Between Oracle Database Editions
- Obtaining Oracle Database Software
- PHP Considerations
- Apache HTTP Server
- Why PHP 5
- Obtaining PHP
- Making PHP and Oracle Work Together
- Oracle Instant Client
- Zend Core for Oracle
- Using Oracle SQL*Plus
- Why Use SQL*Plus in PHP/Oracle Development?
- Connecting to a Database with SQL*Plus
- Running Scripts in SQL*Plus
- Putting It All Together
- Creating Your First PHP/Oracle Application
- Connecting to a Database
- Using the Local Naming Method
- Using the Easy Connect Method
- Issuing an SQL Statement Against the Database
- Fetching and Displaying Results
- Connecting to a Database
- Summary
- Why PHP and Oracle?
- Chapter 2: PHP and Oracle Connection
- Introducing the PHP OCI8 Extension
- Why Use OCI8 Extension?
- Processing SQL Statements with OCI8
- Connecting to Oracle with OCI8
- Defining a Connection String
- OCI8 Functions for Connecting to Oracle
- Parsing and Executing SQL Statements with OCI8
- Preparing SQL Statements for Execution
- Using Bind Variables
- Executing SQL Statements
- Handling Errors
- Using the oci_error Function
- Using the trigger_error Function
- Using Exceptions
- Fetching Results with OCI8
- OCI8 Functions for Fetching
- Fetching the Next Row
- Fetching All the Rows
- Alternatives to PHP OCI8 Extension
- Using PEAR DB
- Using ADOdb
- Using PDO
- Creating Your Own Library on Top of OCI8
- Summary
- Introducing the PHP OCI8 Extension
- Chapter 3: Data Processing
- Implementing the Business Logic of a PHP/Oracle Application
- When to Move the Data to the Processing
- Advantages of Moving the Processing to the Data
- Ways of Implementing Business Logic Inside the Database
- Interaction between Components Implementing Business Logic
- Using Complex SQL Statements
- Employing Oracle SQL Functions in Queries
- Oracle SQL Functions versus PHP Data Processing
- Aggregate Functions
- The GROUP BY Clause
- Using Join Queries
- Taking Advantage of Views
- The Key Benefits of Using Views
- Hiding Data Complexity with Views
- Using the WHERE Clause
- Employing Oracle SQL Functions in Queries
- Using Stored Subprograms
- What are Stored Subprograms?
- Advantages of Stored Subprograms
- An Example of When to Use a Stored Subprogram
- Creating Stored Subprograms
- Calling Stored Subprograms from PHP
- Using Triggers
- Creating Triggers
- Firing Triggers
- Calling Stored Procedures from a Trigger
- Summary
- Implementing the Business Logic of a PHP/Oracle Application
- Chapter 4: Transactions
- Overview of Transactions
- What is a Transaction?
- What are ACID Rules?
- How Transactions Work in Oracle
- Using Transactions in PHP/Oracle Applications
- Structuring a PHP/Oracle Application to Control Transactions
- Developing Transactional Code
- Controlling Transactions from PHP
- Moving Transactional Code to the Database
- Using Triggers
- Dealing with Statement-Level Rollbacks
- Transaction Isolation Considerations
- What OCI8 Connection Function to Choose
- Concurrent Update Issues
- Locking Issues
- Lost Updates
- Autonomous Transactions
- Summary
- Overview of Transactions
- Chapter 5: Object-Oriented Approach
- Implementing PHP Classes to Interact with Oracle
- Building Blocks of Applications
- Creating a Custom PHP Class from Scratch
- Testing the Newly Created Class
- Taking Advantage of PHP 5's Object-Oriented Features
- Functionality and Implementation
- Reusability
- Handling Exceptions
- Modifying an Existing Class to use Exceptions
- Distinguishing between Different Error Types
- Are Exceptions Necessarily Errors?
- Building Blocks of Applications
- Extending Existing Classes
- Using Standard Classes
- PEAR::Auth in Action
- Securing Pages with PEAR::Auth
- Customizing Standard Classes
- Customizing PEAR::Auth
- Building More Compact Client Code
- Using Standard Classes
- Interactions between Objects
- Composition
- Aggregation
- Event-Driven Communication
- Using Oracle Object-Relational Features
- Using Oracle Object Types
- Implementing Business Logic with Methods of Oracle Objects
- Using Oracle Objects to Simplify Application Creation
- Summary
- Implementing PHP Classes to Interact with Oracle
- Chapter 6: Security
- Securing PHP/Oracle Applications
- Authenticating Users
- Separating Security Management and Data
- Using Two Database Schemas to Improve Security
- Using Three Database Schemas to Improve Security
- Employing PL/SQL Packages and Table Functions to Securely Access Database Data
- Using the %ROWTYPE Attribute
- Building a Custom Storage Container for the PEAR::Auth Class
- Testing the Authentication System
- Performing Authorization Based on the User Identity
- Using Sessions to Hold Information about the Authenticated User
- Holding a User's Information in Package Variables
- Protecting Resources Based on Information about the Authenticated User
- Hashing
- Hashing Passwords
- Modifying an Authentication System to Use Hashing
- Setting Up Fine-Grained Access with Database Views
- Implementing Column-Level Security with Views
- Masking the Column Values Returned to the Application
- Using the DECODE Function
- Implementing Row-Level Security with Views
- Using VPD to Implement Row-Level Security
- Summary
- Securing PHP/Oracle Applications
- Chapter 7: Caching
- Caching Data with Oracle and PHP
- Caching Queries on the Database Server
- Processing SQL Statements
- Using Bind Variables to Increase the Probability of Shared Pool Cache Hits
- Using Oracle's Application Contexts for Caching
- Creating a Global Application Context
- Manipulating Data Held in a Global Context
- Resetting Values in a Global Context
- Caching Mechanisms Available in PHP
- Choosing a Caching Strategy
- Caching Function Calls with the PEAR::Cache_Lite Package
- Updating Cached Data
- Caching Queries on the Database Server
- Implementing Notification-Based Caching
- Using Database Change Notification
- Auditing Notification Messages
- Building a PL/SQL Procedure Sending Notifications to the Web Server
- Performing Configuration Steps Required for Change Notification
- Building the Notification Handler
- Creating a Query Registration for the Notification Handler
- Quick Test
- Implementing Notification-Based Caching with PEAR::Cache_Lite
- Using Database Change Notification
- Summary
- Caching Data with Oracle and PHP
- Chapter 8: XML-Enabled Applications
- Processing XML in PHP/Oracle Applications
- Processing XML Data with PHP
- Creating XML with the DOM PHP Extension
- Querying a DOM Document with XPath
- Transforming and Processing XML with XSLT
- Performing XML Processing inside the Database
- Using Oracle SQL/XML Generation Functions
- Moving All the XML Processing into the Database
- Storing XML Data in the Database
- Performing XSLT Transformations inside the Database
- Processing XML Data with PHP
- Building PHP Applications on Oracle XML DB
- Using Oracle Database for Storing, Modifying, and Retrieving XML Data
- Database Storage Options for XML Data in Oracle Database
- Using XMLType for Handling XML Data in the Database
- Using XML Schemas
- Retrieving XML Data
- Accessing Relational Data Through XMLType Views
- Using XMLType Views
- Creating XML Schema-Based XMLType Views
- Performing DML Operations on XML Schema-Based XMLType Views
- Using Oracle XML DB Repository
- Manipulating Repository Resources with PL/SQL
- Accessing Repository Resources with SQL
- Taking Advantage of Standard Internet Protocols
- Handling Transactions
- Using Oracle Database for Storing, Modifying, and Retrieving XML Data
- Querying Data with Oracle XQuery
- Using XQuery to Construct XML from Relational Data
- Breaking up XML into Relational Data
- Summary
- Processing XML in PHP/Oracle Applications
- Chapter 9: Web Services
- Exposing a PHP/Oracle Application as a Web Service Using PHP SOAP Extension
- Communicating Using SOAP
- What you Need to Build a SOAP Web Service
- Building a SOAP Web Service on Top of a PHP/Oracle Application
- Building the Business Logic of a Web Service Inside the Database
- Creating an XML Schema to Validate Incoming Documents
- Generating Unique IDs for Incoming Documents
- Creating PL/SQL Subprograms Implementing the Business Logic of the Web Service
- Building a PHP Handler Class
- Using WSDL
- Creating a SOAP Server with PHP's SOAP Extension
- Building a SOAP Client to Test the SOAP Server
- Adding Security
- Implementing Authorization Logic Inside the Database
- Creating a PHP Handler Class
- Creating a WSDL Document
- Creating a Client Script
- Summary
- Exposing a PHP/Oracle Application as a Web Service Using PHP SOAP Extension
- Chapter 10: AJAX-Based Applications
- Building AJAX-Based PHP/Oracle Applications
- AJAX Interactions
- Designing an AJAX/PHP/Oracle Monitoring Application
- Building Blocks of an AJAX-Based Solution
- Creating the Data Structures
- Building the PHP Script that will Process AJAX Requests
- Using the XMLHttpRequest JavaScript Object
- Putting It All Together
- Using Caching to Further Improve Responsiveness
- Implementing Master/Detail Solutions with AJAX
- Planning a Master/Detail Solution that uses AJAX
- Building the Sample Application
- Creating the Data Structures
- Generating HTML with Oracle XQuery
- Sending Post Requests with AJAX
- Styling with CSS
- Putting It All Together
- Summary
- Building AJAX-Based PHP/Oracle Applications
- Appendix A: Installing PHP and Oracle Software
- Installing Oracle Database Software
- Installing Oracle Database Enterprise/Standard Editions
- Installing Oracle Database Express Edition (XE)
- Installing Oracle Database XE on Windows
- Installing Oracle Database XE on Linux
- Installing Apache HTTP Server
- Installing PHP
- Installing PHP on Windows
- Installing PHP on Unix-Like Systems
- Testing PHP
- Bridging the Gap Between Oracle and PHP
- Oracle Instant Client
- Enabling the OCI8 Extension in an Existing PHP Installation
- Installing SQL*Plus Instant Client
- Installing Zend Core for Oracle
- Installing Zend Core for Oracle on Windows
- Installing Zend Core for Oracle on Linux
- Installing Oracle Database Software


