-
Installing Oracle 10g R2 , Apache (2.0.54), and PHP (5.0.4) on CentOS 4.1 (RHEL 4 U1)
Download from:-
http://www.oracle.com/technology/sof...linuxsoft.html
Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI Applications
oracle-instantclient-basic-10.2.0.1-1.i386.rpm
instantclient-basic-linux32-10.2.0.1-20050713.zip
Instant Client Package - SQL*Plus: Additional libraries and executable for running SQL*Plus with Instant Client
oracle-instantclient-sqlplus-10.2.0.1-1.i386.rpm
instantclient-sqlplus-linux32-10.2.0.1-20050713.zip
Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client
oracle-instantclient-devel-10.2.0.1-1.i386.rpm
instantclient-sdk-linux32-10.2.0.1-20050713.zip
Install PHP, Apache and Oracle Instant Client
Installing and testing Instant Client
Run as root:-
# rpm –Uvh oracle-instantclient-basic-10.2.0.1-1.i386.rpm
# rpm –Uvh oracle-instantclient-sqlplus-10.2.0.1-1.i386.rpm
# rpm –Uvh oracle-instantclient-devel-10.2.0.1-1.i386.rpm
# useradd -g oinstall –G dba orauser
# passwd orauser
Login as orauser.Test connection to the database:
$ export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.1/client/lib
$ /usr/lib/oracle/10.2.0.1/client/bin/sqlplus scott/passwd@//hostname/orclraw
SQL> exit
Installing and testing Apache
Login as your "orauser" user
Build Apache:
$ bzcat httpd-2.0.54.tar.bz2 | tar xf -
$ cd httpd-2.0.54
$ ./configure --prefix=$HOME/apache --enable-so --with-mpm=prefork
$ make
$ make install
Edit $HOME/apache/conf/httpd.conf and change the port to 8888:
Listen hostname:8888
Start Apache:
$HOME/apache/bin/apachectl start
Start a browser and check that http://hostname:8888/ gives the
default Apache web page.
Stop Apache:
$HOME/apache/bin/apachectl stop
Installing and testing PHP
Build PHP:
$ bzcat php-5.0.4.tar.bz2 | tar xf -
$ cd php-5.0.4
$ ./configure \
--prefix=$HOME/php \
--with-apxs2=$HOME/apache/bin/apxs \
--with-config-file-path=$HOME/apache/conf \
--with-oci8-instant-client=/usr/lib/oracle/10.2.0.1/client/lib \
--enable-sigchild
$ make
$ make install
$ cp php.ini-recommended $HOME/apache/conf/php.ini
Edit php.ini and change display_errors to On:
display_errors = On
Add these lines to the $HOME/apache/conf/httpd.conf file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Restart Apache:
$HOME/apache/bin/apachectl start
LD_LIBRARY_PATH should contains /usr/lib/oracle/10.2.0.1/client/lib before
starting Apache
Test it all works
TEST 1:
Create a file $HOME/apache/htdocs/phpinfo.php containing:
phpinfo();
?>
Load this file in a browser:
http://hostname:8888/phpinfo.php
Check the value of LD_LIBRARY_PATH in the Environment section.
it should contain the Instant Client directory.
Check that there is a section "oci8" with OCI8 Support marked as
"enabled".
TEST 2:
Create a file $HOME/apache/htdocs/test.php containing:
$conn = OCILogon("scott", "tiger", "//hostname/orclraw");
if (!$conn) {
exit;
}
echo OCIServerVersion($conn) ." \n";
print date('Y-m-d H:i:s')."
\n";
$query = 'SELECT * FROM EMP';
$stid = OCIParse($conn, $query);
OCIExecute($stid, OCI_DEFAULT);
print '';
while ($succ = OCIFetchInto($stid, $row, OCI_RETURN_NULLS)) {
print '';
foreach ($row as $item) {
print ''.($item?htmlentities($item):' ').' | ';
}
print ' ';
}
print ' ';
OCILogoff($conn);
?>
Load this file in a browser:
http://hostname:8888/test.php
Last edited by dba477; 11-10-2005 at 12:53 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|