Home arrow Oracle arrow Configuring Oracle Database XE and PHP

Configuring Oracle Database XE and PHP

In this conclusion to a five-part article series on installing and configuring Oracle Database XE, you will learn how to enable PHP to connect to the Oracle database. This article is excerpted from chapter 27 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).

  1. Configuring Oracle Database XE and PHP
  2. Performing Post-Installation Tasks
By: Apress Publishing
Rating: starstarstarstarstar / 2
December 02, 2010

print this article



Configuring Oracle and PHP

Now that you have all of the required components for your OPAL installed, you must perform the final hookup: enabling PHP to connect to the Oracle database.

Locate the PHP configuration filephp.iniyou created in Chapter 2. In a default installation on Red Hat Enterprise Linux 4, it is located in/etc/php.ini. Open the file in your favorite text editor and locate this line in the file:


Remove the semicolon at the beginning of the line and save the file in its original location. If you are not using Zend Core for Oracle on your Linux server, you automatically have OCI8 configured. If you do not even haveoci8.soin your extensions directory, you can get it as a PEAR module using the following command:

pear download oci8

Next, you must reconfigure PHP with the--with-oci8option.

For these changes to take effect, you must restart the Apache HTTP server. The easiest way to do this in Linux is to run this command:

/etc/init.d/httpd restart

To see if PHP can connect to Oracle successfully, create the filetest_ora_conn.phpusing the code in Listing 27-1 and place it in your Apache document root. For a default Apache 2.0 or 2.2 installation on Red Hat Linux, the document root directory is/var/www/html.

Be sure to substitute the password you entered in the step shown in Figure 27-4 in the second line of the script; otherwise you will exercise theelseclause of theifstatement in the PHP code. Navigate to the URLhttp://localhost/test_ora_conn.php, and you should see the success message in the firstprintstatement.

>>> More Oracle Articles          >>> More By Apress Publishing

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Java Security Woes Continue
- Oracle's New IaaS Cloud Option: There's a Ca...
- Oracle Acquires Eloqua to Boost Cloud Presen...
- Choosing Innovation: Oracle Survey Insights
- Oracle Fixes Privilege Escalation Bug
- Oracle`s Communications Service Availability...
- Oracle Releases Exalytics, Taleo Plans
- Oracle Releases Communications Network Integ...
- Oracle Releases Communications Data Model 11...
- Oracle Releases PeopleSoft PeopleTools 8.52
- Oracle Integrates Cloudera Apache Distro, My...
- Oracle Releases MySQL 5.5.18
- Oracle Announces NoSQL Database Availability
- Sorting Database Columns With the SELECT Sta...
- Retrieving Table Data with the LIKE Operator

Developer Shed Affiliates


Dev Shed Tutorial Topics: