1 Introducing PHP with Oracle Database

PHP is a popular scripting language that can be embedded in HTML which makes it particularly useful for Web development.

This chapter contains the following topics:

Purpose

This guide shows you how to create a web application using the PHP scripting language and Oracle Database.

Overview of the Sample Application

This document guides you through the development of a sample application that manages the tracking of company equipment for a fictitious company called AnyCo Corp. For this introduction to the PHP language and the PHP OCI8 extension which accesses the Oracle database, no PHP framework or abstraction layer is used. However, frameworks are popular and they should be evaluated when building applications. They provide functionality to do tasks the AnyCo application has to manually implement, and they can provide a good application design paradigm.

The AnyCo application uses employee data from the EMPLOYEES table in the sample HR schema provided with Oracle Database. See Oracle Database Sample Schemas for information about this schema. A new table will be created for this application to hold details about the company equipment allocated to each employee.

Figure 1-1 shows the overview of the sample application.

Figure 1-1 Overview of the Sample Application

AnyCo

The application will perform the following functions:

  • Establish a connection to the database using the PHP OCI8 extension. An Oracle connection pool is used to demonstrate how applications can be made scalable.

  • Query the database employee and equipment data.

  • Display and navigate through the data.

  • Show how to insert and fetch records in various ways, including fetching using a PL/SQL REF CURSOR.

  • Show how to tune PHP fetching data from SQL queries.

  • Show how to create and use a web service.

  • Upload and display an image.

  • Show how to monitor the application's use of database resources.

Resources

The following Oracle Technology Network Web sites provide additional information you may find useful.