PHP 4.0 Bug #7847 Updated: OCI8 support with Oracle 8.1.5 doesn't work
| From: | sniper@php.net | Date: | Sun, 19 Nov 2000 03:45:44 +0000 |
| Subject: | PHP 4.0 Bug #7847 Updated: OCI8 support with Oracle 8.1.5 doesn't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38491@lists.php.net to get a copy of this message | ||
ID: 7847
Updated by: sniper
Reported By: msquillace@sogei.it
Status: Feedback
Bug Type: OCI8 related
Assigned To:
Comments:
Have you set the Oracle specific environment vars mentioned on
http://www.php.net/manual/ref.oci8.php before
starting Apache?
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-11-16 12:15:18] msquillace@sogei.it
I can't get OCI8 support to work on AIX 4.2.
During the last few weeks I have been able to configure an
Apache 1.3.12 server (with and without SSL support) to load
PHP 4 and several extensions (cURL, zlib, ClibPDF, openLDAP)
on this RS600 model F40 but the single extension that I
absolutely need (OCI8) doesn't want to work.
I use gcc and want to create a DSO module for PHP, but have
also tried static compilation and the standard AIX 4.2 cc
compiler without success; further, I started out with PHP
4.0.3 then tried 4.0.3pl1 and now downloaded the latest
CVS, to no avail.
In the following I detail the steps needed to create a
"stripped down" version of Apache+PHP4+OCI8, and describe
the behaviour I observe.
I am available for whatever further information you may
need in order to solve the problem; please reply as soon
as possible since I need to meet a deadline and, more
importantly, am trying to introduce this technology in
a company where Open Source software is still viewed
skeptically.
Prerequisite packages installation and setup
-------------------------------
01) login as root
02) gcc-2.95.2 (AIX 4.2 binaries from aixpdslib.seas.ucla.edu)
03) (GNU) make-3.79 (AIX 4.2 binaries from aixpdslib.seas.ucla.edu)
04) perl.5.005_03 (AIX 4.2 binaries from aixpdslib.seas.ucla.edu)
05) bison-1.28 [./configure, make, make install]
06) flex-2.5.4 [./configure, make, make install]
07) setup environment in order to force usage
of gcc and GNU make.
08) setup environment in order to connect to Oracle 8.1.5
and test connection via sqlplus.
09) untar in /opt/src Apache 1.3.12 and latest PHP 4 sources.
Apache+mod_so installation
--------------------
01) delete const keyword from the char *dlerror definitions
in /opt/src/apache_1.3.12/src/os/unix/os.h and
/opt/src/apache_1.3.12/src/os/unix/os-aix-dso.c
to avoid eventual make failure in the PHP4 step(s)
02) cd /opt/src/apache_1.3.12
03)./configure --enable-module=so --prefix=/opt/www
04) make
05) make install
06) uncomment ServerName directive in /opt/www/conf/httpd.conf
Apache installation test (OK)
--------------------
01) /opt/www/bin/apachectl start
02) connect to the server via netscape
03) /opt/www/bin/apachectl stop
Build PHP4 as a dynamic module via APXS with OCI8 support
(Oracle 8.1.5) and a minumum of directly supported modules.
Latest build (php4-200011151045) from snaps.php.net.
Oracle 8.1.5 is the last version supported on AIX 4.2;
I observed the exact same behaviour with Oracle 8.0.5.
------------------------------------------
01) in /ora815/lib, execute the command
ln -s libclntsh.a libclntsh.sx.8.0
to force correct detection of Oracle 8.1 in step 03.
02) cd /opt/src/php4-200011151045
mkdir /opt/www/php
mkdir /opt/www/php/bin
tar xvf ../number.tar
03) ./configure --prefix=/opt/www --mandir=/usr/man
--with-config-file-path=/opt/www/conf
--enable-safe-mode --with-exec-dir=/opt/www/php/bin
--enable-track-vars --enable-magic-quotes
--with-apxs=/opt/www/bin/apxs
--with-mysql=no --enable-sigchild
--enable-trans-sid --enable-versioning
--enable-bcmath --enable-wddx --enable-xml --enable-calendar
--without-gd --with-oci8=/ora815
04) make
During this step I only observe the following warning:
fsock.c: In function `connect_nonb':
fsock.c:182: warning: passing arg 5 of `getsockopt' from
incompatible pointer type
05) make install
06) cp php.ini-optimized /opt/www/conf/php.ini
uncomment the following in /opt/www/conf/httpd.conf:
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps
Test Apache+PHP+OCI8
------------------
01) /opt/www/bin/apachectl start
02) connect to the server via netscape ... OK
03) invoke the info.php script on the server via netscape ... OK
info.php contains:
<?php
phpinfo();
?>
04) invoke ociver1.php on the server via netscape ... NOK
ociver1.php contains:
<?php
OCIInternalDebug(1);
echo "Attempting OCILogon<br>";
error_log("Before OCILogon", 0);
$conn = OCILogon("system","manager", "ZZZ");
error_log("After OCILogon", 0);
echo "Connection handle: >".$conn."<<br>";
echo "Server Version: " . OCIServerVersion($conn);
OCILogOff($conn);
?>
This I expect to fail, since ZZZ is not a defined alias in
Oracle's tnsnames.ora; accordingly on the browser I get:
Attempting OCILogon
Warning: _oci_open_server: ORA-12154: TNS:could not resolve
service name in /opt/www/htdocs/ociver1.php on line 5
OCIDebug: _oci_open_server: FAILURE -> CLEANUP called
OCIDebug: START _oci_close_server: detaching conn=0 dbname=ZZZ
OCIDebug: _oci_close_server: closing DEAD server
OCIDebug: oci_do_connect: FAILURE -> CLEANUP called
OCIDebug: START _oci_conn_list_dtor: id=0
OCIDebug: END _oci_conn_list_dtor: id=0
Connection handle: ><
Warning: Supplied argument is not a valid OCI8-Connection resource
in /opt/www/htdocs/ociver1.php on line 8
Server Version:
Furthermore, if I tail /opt/www/logs/error_log I can correctly see:
[Thu Nov 16 17:18:09 2000] [error] Before OCILogon
[Thu Nov 16 17:18:09 2000] [error] After OCILogon
OCIDebug: START php_rshutdown_oci<br>
OCIDebug: END php_rshutdown_oci<br>
05) invoke ociver2.php on the server via netscape ... NOK
ociver2.php contains:
<?php
OCIInternalDebug(1);
echo "Attempting OCILogon<br>";
error_log("Before OCILogon", 0);
$conn = OCILogon("system","manager", "f40_7");
error_log("After OCILogon", 0);
echo "Connection handle: >".$conn."<<br>";
echo "Server Version: " . OCIServerVersion($conn);
OCILogOff($conn);
?>
In this case I expect the script to _WORK_, since f40_7 _IS_ a defined
alias in Oracle's tnsnames.ora; the browser instead sends a popup along
the lines:
The document contained no data.
Try again later, or contact the server's administrator.
The /opt/www/logs/error_log only registers:
[Thu Nov 16 17:23:17 2000] [error] Before OCILogon
and doing a ps aux | grep http I note that one of the original httpd
daemons has disappeared WITHOUT tracing anything on the
error_log (I'd expect a segfault).
Since I am using net8 (SQL*Net), I have also tried to trace it and also
activated tracing for the Oracle listener, but nothing gets written in
either trace file.
06) /opt/www/bin/apachectl stop
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7847