Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
   
Compile PHP with Oracle and Apache




By Vigyan Kaushik
Dec 27, 2005

Digg! digg!     Print    email to friend Email to Friend

Note: This article was written for educational purpose only. Please refer to the related vendor documentation for detail.




Download Free Confio Software

Compile PHP with Oracle and Apache

How to compile php with apache and oracle client?

Download the required software

Oracle

Oracle 10g R1 : http://www.oracle.com/technology/software/products/database/oracle10g/index.html

Apache

Apache 2.0 : http://httpd.apache.org/

PHP

PHP 5.1.1 :http://www.php.net/downloads.php

Installing Oracle Client

Download and install the Oracle database client if you don't have it already. If you are doing a fresh install then create a user called "oracle" with dba as group and install software as oracle user.

Installing Apache Web Server

Download the apache web server as root and uncompress it.

# tar xvzf httpd-2.0.55.tar.gz
# cd httpd-2.0.55
# ./configure --prefix=/usr/local/apache \
--enable-module=so
# make
# make install

Start the apache web server using following command.

# /usr/local/apache/bin/apachectl start

Go to the http://localhost and check if  web server is running.

Installing PHP

Download the php as root and uncompress it.


# tar xvzf php-5.1.1.tar.gz
# cd php-5.1.1
# ./configure --with-oci8=$ORACLE_HOME \
--with-apxs2=/usr/local/apache/bin/apxs
--enable-sigchild
# make
# make install

Testing Apache and PHP with Oracle

1. Check the PHP options: Create a file "phpinfo.php" with the following code.

<?php
phpinfo();
?>

Open this file in your default web browser. e.g. http://localhost/phpinfo.php

This page will display all the options that PHP has been configured with.

2. Test the Oracle and PHP connectivity: Create a file called "oratest.php" with the following code.

<?php
if ($conn=OCILogon("scott", "tiger", "orcl")) {
echo "Successfully connected to Oracle using OCI extension.\n";
OCILogoff($conn);
} else {
$err = OCIError();
echo "Error in connecting to the Oracle." . $err[text];
}
?>
 

 

 

 

 
About author:

Vigyan Kaushik is an Oracle certified professional serving IT industry for more than 11 years as an Oracle DBA and System Administrator. He has expertise in Database Designing, Administration, Networking, Tuning, Implementation, Maintenance with web deployment activities on different Unix flavors as well as on Windows Operating Systems.

 

Please login to post your comments





  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software