PHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax

PHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 45%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Program your own PHP/Oracle application
  • Move data processing inside the database
  • Distribute data processing between the web/PHP and Oracle database servers
  • Create reusable building blocks for PHP/Oracle solutions
  • Use up-to-date technologies, such as Ajax and web services, in PHP Oracle development


Book Details

Language : English
Paperback : 396 pages [ 235mm x 191mm ]
Release Date : July 2007
ISBN : 1847193633
ISBN 13 : 9781847193636
Author(s) : Yuli Vasiliev
Topics and Technologies : All Books, Enterprise Products and Platforms, Oracle Other, Enterprise, Oracle, Web Development

Table of Contents

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
  • 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
    • Summary
  • 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
  • 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
    • 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
  • 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
  • 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?
    • 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
    • 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
  • 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
  • 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
    • 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
    • Summary
  • 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
    • 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
    • Querying Data with Oracle XQuery
      • Using XQuery to Construct XML from Relational Data
      • Breaking up XML into Relational Data
    • Summary
  • 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
  • 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
  • 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

Yuli Vasiliev

Yuli Vasiliev is a software developer, freelance author, and consultant currently specializing in open-source development, Oracle technologies, and service-oriented architecture (SOA). He has over 10 years of software development experience as well as several years of technical writing experience. He wrote a series of technical articles for Oracle Technology Network (OTN) and Oracle Magazine.

Contact Yuli Vasiliev

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 11 submitted: last submission 30 Dec 2011

Errata type: Typo | Page number: 22 |

In the screenshot: "OCIB" should read "OCI8"


Errata type: Typo | Page number: 44 |

In the first line of the "Using Exceptions" paragraph,"build-in" should be "built-in"


Errata type: Code | Page number: 47 |

At the end of the an example getEmployees.php there is a space between $ and employess: "return array ($nrows, $ employees);" It should be like this: return array ($nrows, $employees);


Errata type: Code | Page number: 48 |

In the example of script deptEmployees.php, at the line 4 writes $employess : "if(list($nrows, $employess) = getEmployees($deptno)){" it should be: '$employees' "if(list($nrows, $employees) = getEmployees($deptno)){"


Errata type: Code | Page number: 48 |

In the example of script deptEmployees.php, at the line 4 writes $employess : "if(list($nrows, $employess) = getEmployees($deptno)){" and it should be '$employess' "if(list($nrows, $employees) = getEmployees($deptno)){"


Errata type: Typo | Page number: 105 |

In the last paragraph: is used to " cerate" the triggershould be is used to "create" the trigger


Errata type: Typo | Page number: 193 |

In the line-Now, suppose you want each sales representative to be "ale" to view all the orders,regardless of who placed an order, but, at the same time....., "ale" should be "able"


Errata type: Typo | Page number: 221 |

TIn the line -Next, you set the default value for the empno input element of the HTM_QuickForm form created.- "HTM_QuickForm" should read "HTML_QuickForm".


Errata type: Layout | Page number: 225 |

In the first line, the first 2 characters of "DB_FETCHMODE_ASSOC" have a wrong font.


Errata type: Missing note | Page number: 283 |

The note should be replaced with the follwing: When it comes to inserting XML data into an XML schema-based table, you could use either the PL/SQL BEFORE INSERT trigger or table-level CHECK constraint instead.


Errata type: Typo | Page number: 333 |

The sentence just above the heading "Building Blocks of an AJAX-Based Solution" reads "In the following 0 sections".It should read : in the following sections...."


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

PHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax +    Implementing Microsoft Dynamics NAV 2013 =
50% Off
the second eBook
Price for both: $45.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Install and configure PHP and Oracle software
  • Connect PHP with Oracle
  • Move key application business logic into the database
  • Build transactional PHP/Oracle applications
  • Use security features of PHP and Oracle
  • Improve performance with caching
  • Employ XML features of PHP and Oracle
  • Implement SOAP Web services with PHP and Oracle
  • Build Ajax-driven PHP/Oracle solutions

Chapter 1 gives an overview of the PHP and Oracle technologies, explaining why you might want to use PHP in conjunction with Oracle.

Chapter 2 covers the basics of using the PHP OCI8 extension to interact with an Oracle database from PHP. It also briefly discusses some popular alternatives to the OCI8 extension to connect to Oracle from within PHP.

Chapter 3
discusses how you can move data processing performed by your PHP/Oracle application into the database by using sophisticated SQL queries, stored PL/SQL procedures, and database triggers.

Chapter 4 discusses the various mechanisms that can be used to perform transactions with PHP and Oracle.

Chapter 5 examines the object-oriented approach to developing PHP/Oracle applications, as an efficient means to reduce the development time and complexity, and increase the maintainability and flexibility of your applications.

Chapter 6 discusses how to effectively use the security features of both PHP and Oracle together, examining the fundamental aspects of building a secure PHP/Oracle application.

Chapter 7 discusses how to effectively use caching mechanisms available in PHP and Oracle and provides several examples of caching in action.

Chapter 8 explains how to effectively use XML techniques and technologies available in PHP and Oracle when building XML-enabled PHP/Oracle applications.

In Chapter 9 you learn how to build a SOAP Web service exposing the functionality of a PHP/Oracle application, using the PHP SOAP extension and Oracle XML technologies.

Chapter 10 explains how Ajax and some other client-side (browser-side) JavaScript technologies can be used along with Oracle Database technologies as well as PHP features to improve the responsiveness of PHP/Oracle applications.

An Appendix covers installation of PHP and Oracle software.

In Detail

Oracle Database gets high marks for performance, reliability, and scalability. Building and deploying your PHP applications on Oracle Database enables you to combine the power and robustness of Oracle and the ease of use, short development time, and high performance of PHP. When used in a complementary way, PHP and Oracle allow you to build high-performance, scalable, and reliable data-driven Web applications with a minimum of effort.

When building a PHP/Oracle application, you have two general options. The first is to use an Oracle database just to store data, performing all the operations on that data on the client side; the other is to use the database not only to store data, but also to process it, thus moving data processing to the data. While building the key business logic of a database-driven PHP application inside the database is always a good idea, you should bear in mind that not all of the databases available today allow you to do. The Oracle database, which offers record-breaking performance, scalability, and reliability, does. The partnership of Oracle and the open-source scripting language PHP is an excellent solution for building high-performance, scalable, and reliable data-driven web applications.

This 100% practical book is crammed full of easy-to-follow examples. It provides all the tools a PHP/Oracle developer needs to take advantage of the winning combination. It addresses the needs of a wide spectrum of PHP/Oracle developers, placing the emphasis on the most up-to-date topics, such as new PHP and Oracle Database features, stored procedure programming, handling transactions, security, caching, web services, and Ajax.

This practical book is built entirely around example code, covering the most popular and up-to-date topics on using PHP in conjunction with Oracle. The book explains in extensive detail how to build robust, efficient, and secure PHP/Oracle solutions.


Through numerous examples, this book shows you how to build simple and efficient PHP applications on top of Oracle, efficiently distributing data processing between the Web/PHP server and Oracle Database server.

Who this book is for

Although this book covers only the most popular and up-to-date topic areas on the use of PHP in conjunction with Oracle, the author does not make any assumption about the skill level of the reader. Packed with information in an easy-to-read format, the book is ideal for any PHP developer who deals with Oracle.

Buy PHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software