|
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];
}
?>
|