# Apache2 + PHP 4.3.6 + Oracle 10g Client, can't access Oracle

## ausmusj1

Not sure if this should go in here or in the Programming forum...

I am building a web-server that needs to be PHP, MySQL, and Oracle enabled on Apache2. I have everything installed, got mod_php and php emerged with the needed configurations, everything works great, EXCEPT for accessing Oracle databases in a PHP page when served from Apache2. I have verified all environment variables are getting to PHP properly, I have verified that the Oracle 10g client itself is set up properly, I have verified that the apache user has rights to access the Oracle client shared libraries, I have verified every single thing that I can think of, but it still won't work. Here's the clincher: It works fine when I run the test php script from the command prompt using the cli version of php. I have even su'd to apache, and run it via php-cli as apache, and it works fine... However, when it is served as a web page from Apache2, it always fails, with the following error:

```
Warning: ocilogon(): _oci_open_server: Error while trying to retrieve text for error ORA-12154 in /var/www/localhost/htdocs/fccorders/includes/testdb.php on line 16
```

Here is my output from phpinfo():

```
PHP Version 4.3.6 

System  Linux ssvs3 2.4.25_pre7-gss-r3 #4 SMP Tue May 18 14:59:07 UTC 2004 i686  

Build Date  May 25 2004 19:22:31  

Configure Command  './configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--disable-pcntl' '--disable-pcntl' '--disable-pcntl' '--disable-pcntl' '--enable-experimental-zts' '--with-apxs2=/usr/sbin/apxs2' '--disable-pcntl' '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr' '--with-interbase=/opt/interbase' '--with-ming=/usr' '--with-swf=/usr' '--with-sybase=/usr' '--with-gdbm=/usr' '--with-fdftk=/opt/fdftk-6.0' '--with-java=/opt/blackdown-jdk-1.4.1' '--with-mcal=/usr' '--with-oci8=/usr/lib/oracle/10.1.0.2/client' '--with-unixODBC=/usr' '--with-pgsql=/usr' '--without-snmp' '--with-xpm-dir=/usr/X11R6' '--with-gmp' '--with-pdflib=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-png=/usr' '--with-png-dir=/usr' '--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' '--with-tiff-dir=/usr' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr' '--with-gettext' '--with-qtdom=/usr/qt/3' '--with-pspell=/usr' '--with-openssl=/usr' '--without-imap' '--with-ldap=/usr' '--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' '--enable-memory-limit' '--disable-ipv6' '--without-yaz' '--with-curlwrappers' '--with-curl=/usr' '--enable-dbx' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring=all' '--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' '--disable-pcntl' '--with-png-dir=/usr' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-filepro' '--enable-ftp' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvipc' '--with-iconv' '--enable-shmop' '--enable-dio' '--enable-yp' '--without-ncurses' '--without-readline' '--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-config-file-path=/etc/php/apache2-php4' '--with-pear'  

Server API  Apache 2.0 Handler  

Virtual Directory Support  enabled  

Configuration File (php.ini) Path  /etc/php/apache2-php4/php.ini  

PHP API  20020918  

PHP Extension  20020429  

Zend Extension  20021010  

Debug Build  no  

Thread Safety  enabled  

Registered PHP Streams  php, http, ftp, https, ftps, compress.bzip2, compress.zlib  

 This program makes use of the Zend Scripting Language Engine:

Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies  

--------------------------------------------------------------------------------

PHP Credits

--------------------------------------------------------------------------------

Configuration

PHP Core

Directive Local Value Master Value 

allow_call_time_pass_reference On On 

allow_url_fopen Off Off 

always_populate_raw_post_data Off Off 

arg_separator.input & & 

arg_separator.output & & 

asp_tags Off Off 

auto_append_file no value no value 

auto_prepend_file no value no value 

browscap no value no value 

default_charset no value no value 

default_mimetype text/html text/html 

define_syslog_variables Off Off 

disable_classes no value no value 

disable_functions no value no value 

display_errors On On 

display_startup_errors Off Off 

doc_root no value no value 

docref_ext no value no value 

docref_root no value no value 

enable_dl On On 

error_append_string no value no value 

error_log no value no value 

error_prepend_string no value no value 

error_reporting 2039 2039 

expose_php On On 

extension_dir /usr/lib/php/extensions/no-debug-zts-20020429 /usr/lib/php/extensions/no-debug-zts-20020429 

file_uploads On On 

gpc_order GPC GPC 

highlight.bg #FFFFFF #FFFFFF 

highlight.comment #FF8000 #FF8000 

highlight.default #0000BB #0000BB 

highlight.html #000000 #000000 

highlight.keyword #007700 #007700 

highlight.string #DD0000 #DD0000 

html_errors On On 

ignore_repeated_errors Off Off 

ignore_repeated_source Off Off 

ignore_user_abort Off Off 

implicit_flush Off Off 

include_path .:/usr/lib/php .:/usr/lib/php 

log_errors Off Off 

log_errors_max_len 1024 1024 

magic_quotes_gpc On On 

magic_quotes_runtime Off Off 

magic_quotes_sybase Off Off 

max_execution_time 30 30 

max_input_time 60 60 

memory_limit 8M 8M 

open_basedir no value no value 

output_buffering no value no value 

output_handler no value no value 

post_max_size 8M 8M 

precision 12 12 

register_argc_argv On On 

register_globals Off Off 

report_memleaks On On 

safe_mode Off Off 

safe_mode_exec_dir no value no value 

safe_mode_gid Off Off 

safe_mode_include_dir no value no value 

sendmail_from no value no value 

sendmail_path /usr/sbin/sendmail -t -i  /usr/sbin/sendmail -t -i  

serialize_precision 100 100 

short_open_tag On On 

SMTP localhost localhost 

smtp_port 25 25 

sql.safe_mode Off Off 

track_errors Off Off 

unserialize_callback_func no value no value 

upload_max_filesize 2M 2M 

upload_tmp_dir no value no value 

user_dir no value no value 

variables_order EGPCS EGPCS 

xmlrpc_error_number 0 0 

xmlrpc_errors Off Off 

y2k_compliance On On 

apache2handler

Apache Version  Apache/2.0.49 (Gentoo/Linux) mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6  

Apache API Version  20020903  

Server Administrator  root@localhost  

Hostname:Port  ssvs3:0  

User/Group  apache(81)/81  

Max Requests  Per Child: 0 - Keep Alive: on - Max Per Connection: 100  

Timeouts  Connection: 300 - Keep-Alive: 15  

Virtual Server  No  

Server Root  /usr/lib/apache2  

Loaded Modules  core worker http_core mod_so mod_access mod_auth mod_auth_anon mod_auth_dbm mod_auth_digest mod_include mod_log_config mod_env mod_mime_magic mod_cern_meta mod_expires mod_headers mod_usertrack mod_unique_id mod_setenvif mod_proxy proxy_connect proxy_ftp proxy_http mod_mime mod_status mod_autoindex mod_asis mod_info mod_cgi mod_cgid mod_vhost_alias mod_negotiation mod_dir mod_imap mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_file_cache mod_echo mod_charset_lite mod_cache mod_disk_cache mod_mem_cache mod_ext_filter mod_case_filter mod_case_filter_in mod_deflate mod_logio mod_ssl sapi_apache2  

Directive Local Value Master Value 

engine 1 1 

last_modified 0 0 

xbithack 0 0 

Apache Environment

Variable Value 

UNIQUE_ID  ZiFnqH8AAAEAAE85scEAAABA  

ORACLE_HOME  /usr/lib/oracle/10.1.0.2/client  

TNS_ADMIN  /usr/lib/oracle/10.1.0.2/client/network/admin  

LD_LIBRARY_PATH  /usr/lib:/usr/apache2/lib:/usr/oracle/10.1.0.2/client/lib  

ORA_NLS33  /usr/lib/oracle/10.1.0.2/client/nls/admin/data  

ORACLE_SID  SUPRTPRD  

ORACLE_BASE  /usr/lib/oracle  

LD_PRELOAD  /usr/lib:/usr/apache2/lib:/usr/oracle/10.1.0.2/client/lib  

NLS_LANG  AMERICAN_AMERICA.WE8ISO8859P1  

HTTP_ACCEPT  image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, application/x-shockwave-flash, */*  

HTTP_ACCEPT_LANGUAGE  en-us  

HTTP_ACCEPT_ENCODING  gzip, deflate  

HTTP_USER_AGENT  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)  

HTTP_HOST  ssvs3  

HTTP_CONNECTION  Keep-Alive  

PATH  /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/opt/interbase/bin:.:/root/bin:.:/root/bin  

SERVER_SIGNATURE  <address>Apache/2.0.49 (Gentoo/Linux) mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6 Server at ssvs3 Port 80</address>  

SERVER_SOFTWARE  Apache/2.0.49 (Gentoo/Linux) mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6  

SERVER_NAME  ssvs3  

SERVER_ADDR  172.16.81.46  

SERVER_PORT  80  

REMOTE_ADDR  172.16.81.104  

DOCUMENT_ROOT  /var/www/localhost/htdocs  

SERVER_ADMIN  root@localhost  

SCRIPT_FILENAME  /var/www/localhost/htdocs/info.php  

REMOTE_PORT  4001  

GATEWAY_INTERFACE  CGI/1.1  

SERVER_PROTOCOL  HTTP/1.1  

REQUEST_METHOD  GET  

QUERY_STRING  no value  

REQUEST_URI  /info.php  

SCRIPT_NAME  /info.php  

HTTP Headers Information

HTTP Request Headers 

HTTP Request  GET /info.php HTTP/1.1  

Accept  image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, application/x-shockwave-flash, */*  

Accept-Language  en-us  

Accept-Encoding  gzip, deflate  

User-Agent  Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)  

Host  ssvs3  

Connection  Keep-Alive  

HTTP Response Headers 

X-Powered-By  PHP/4.3.6  

Keep-Alive  timeout=15, max=100  

Connection  Keep-Alive  

Transfer-Encoding  chunked  

Content-Type  text/html; charset=ISO-8859-1  

bcmath

BCMath support  enabled  

bz2

BZip2 Support  Enabled  

BZip2 Version  1.0.2, 30-Dec-2001  

calendar

Calendar support  enabled  

crack

crack support enabled 

Directive Local Value Master Value 

crack.default_dictionary no value no value 

ctype

ctype functions  enabled  

curl

CURL support  enabled  

CURL Information  libcurl/7.11.0 OpenSSL/0.9.7d zlib/1.1.4  

dba

DBA support  enabled  

Supported handlers  gdbm ndbm cdb cdb_make db4 inifile flatfile  

dbx

dbx support  enabled  

dbx version  1.0.0  

supported databases  MySQL ODBC PostgreSQL Microsoft SQL Server FrontBase Oracle 8 (oci8) Sybase-CT  

Directive Local Value Master Value 

dbx.colnames_case unchanged unchanged 

dio

dio support  enabled  

domxml

DOM/XML  enabled  

DOM/XML API Version  20020815  

libxml Version  20607  

HTML Support  enabled  

XPath Support  enabled  

XPointer Support  enabled  

DOM/XSLT  enabled  

libxslt Version  1.1.4  

libxslt compiled against libxml Version  2.6.7  

DOM/EXSLT  enabled  

libexslt Version  1.1.4  

exif

EXIF Support  enabled  

EXIF Version  1.4 $Id: exif.c,v 1.118.2.27 2003/12/17 09:08:37 helly Exp $  

Supported EXIF Version  0220  

Supported filetypes  JPEG,TIFF  

fdf

FDF Support  enabled  

FdfTk Version  6.0  

ftp

FTP support  enabled  

gd

GD Support  enabled  

GD Version  bundled (2.0.22 compatible)  

FreeType Support  enabled  

FreeType Linkage  with freetype  

T1Lib Support  enabled  

GIF Read Support  enabled  

JPG Support  enabled  

PNG Support  enabled  

WBMP Support  enabled  

XBM Support  enabled  

gettext

GetText Support  enabled  

gmp

gmp support  enabled  

iconv

iconv support  enabled  

iconv implementation  glibc  

iconv library version  2.3.2  

Directive Local Value Master Value 

iconv.input_encoding ISO-8859-1 ISO-8859-1 

iconv.internal_encoding ISO-8859-1 ISO-8859-1 

iconv.output_encoding ISO-8859-1 ISO-8859-1 

interbase

Interbase Support  enabled  

Revision  $Revision: 1.91.2.31 $  

Allow Persistent Links  Yes  

Persistent Links  0/unlimited  

Total Links  0/unlimited  

Timestamp Format  %m/%d/%Y %H:%M:%S  

Date Format  %m/%d/%Y  

Time Format  %H:%M:%S  

java

Directive Local Value Master Value 

java.class.path /usr/lib/php/extensions/no-debug-zts-20020429/php_java.jar /usr/lib/php/extensions/no-debug-zts-20020429/php_java.jar 

java.home no value no value 

java.library /opt/blackdown-jdk-1.4.1/jre/lib/i386/libjava.so /opt/blackdown-jdk-1.4.1/jre/lib/i386/libjava.so 

java.library.path /usr/lib/php/extensions/no-debug-zts-20020429 /usr/lib/php/extensions/no-debug-zts-20020429 

ldap

LDAP Support  enabled  

RCS Version  $Id: ldap.c,v 1.130.2.9 2003/10/07 00:36:27 iliaa Exp $  

Total Links  0/unlimited  

API Version  2004  

Vendor Name  OpenLDAP  

Vendor Version  20125  

mbstring

Multibyte Support  enabled  

Japanese support  enabled  

Simplified chinese support  enabled  

Traditional chinese support  enabled  

Korean support  enabled  

Russian support  enabled  

Multibyte (japanese) regex support  enabled  

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1. 

Directive Local Value Master Value 

mbstring.detect_order no value no value 

mbstring.encoding_translation Off Off 

mbstring.func_overload 0 0 

mbstring.http_input pass pass 

mbstring.http_output pass pass 

mbstring.internal_encoding ISO-8859-1 no value 

mbstring.language neutral neutral 

mbstring.substitute_character no value no value 

mcal

MCAL Support  enabled  

MCAL Version  0.6 - 20000121  

mcrypt

mcrypt support enabled 

version  >= 2.4.x  

Supported ciphers  cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes  

Supported modes  cbc cfb ctr ecb ncfb nofb ofb stream  

Directive Local Value Master Value 

mcrypt.algorithms_dir no value no value 

mcrypt.modes_dir no value no value 

mhash

MHASH support  Enabled  

MHASH API Version  20020524  

mime_magic

mime_magic support enabled 

Directive Local Value Master Value 

mime_magic.magicfile /usr/share/misc/file/magic.mime /usr/share/misc/file/magic.mime 

ming

Ming SWF output library  enabled  

Version  0.2a  

mysql

MySQL Support enabled 

Active Persistent Links  0  

Active Links  0  

Client API version  4.0.18  

MYSQL_MODULE_TYPE  external  

MYSQL_SOCKET  /var/run/mysqld/mysqld.sock  

MYSQL_INCLUDE  -I/usr/include/mysql  

MYSQL_LIBS  -L/usr/lib -lmysqlclient  

Directive Local Value Master Value 

mysql.allow_persistent On On 

mysql.connect_timeout 60 60 

mysql.default_host no value no value 

mysql.default_password no value no value 

mysql.default_port no value no value 

mysql.default_socket no value no value 

mysql.default_user no value no value 

mysql.max_links Unlimited Unlimited 

mysql.max_persistent Unlimited Unlimited 

mysql.trace_mode Off Off 

oci8

OCI8 Support  enabled  

Revision  $Revision: 1.183.2.12 $  

Oracle Version  10.1  

Compile-time ORACLE_HOME  /usr/lib/oracle/10.1.0.2/client  

Libraries Used  no value  

odbc

ODBC Support enabled 

Active Persistent Links  0  

Active Links  0  

ODBC library  unixODBC  

ODBC_INCLUDE  -I/usr/include  

ODBC_LFLAGS  -L/usr/lib  

ODBC_LIBS  -lodbc  

Directive Local Value Master Value 

odbc.allow_persistent On On 

odbc.check_persistent On On 

odbc.default_db no value no value 

odbc.default_pw no value no value 

odbc.default_user no value no value 

odbc.defaultbinmode return as is return as is 

odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes 

odbc.max_links Unlimited Unlimited 

odbc.max_persistent Unlimited Unlimited 

openssl

OpenSSL support  enabled  

OpenSSL Version  OpenSSL 0.9.7d 17 Mar 2004  

overload

User-Space Object Overloading Support  enabled  

pcre

PCRE (Perl Compatible Regular Expressions) Support  enabled  

PCRE Library Version  4.5 01-December-2003  

pdf

PDF Support  enabled  

PDFlib GmbH Version  5.0.2  

Revision  $Revision: 1.112.2.9 $  

pgsql

PostgreSQL Support enabled 

PostgreSQL(libpq) Version  7.4.2  

Multibyte character support  enabled  

SSL support  enabled  

Active Persistent Links  0  

Active Links  0  

Directive Local Value Master Value 

pgsql.allow_persistent On On 

pgsql.auto_reset_persistent Off Off 

pgsql.ignore_notice Off Off 

pgsql.log_notice Off Off 

pgsql.max_links Unlimited Unlimited 

pgsql.max_persistent Unlimited Unlimited 

posix

Revision  $Revision: 1.51.2.2 $  

pspell

PSpell Support  enabled  

qtdom

qtdom support enabled 

session

Session Support  enabled  

Registered save handlers  files user  

Directive Local Value Master Value 

session.auto_start Off Off 

session.bug_compat_42 On On 

session.bug_compat_warn On On 

session.cache_expire 180 180 

session.cache_limiter nocache nocache 

session.cookie_domain no value no value 

session.cookie_lifetime 0 0 

session.cookie_path / / 

session.cookie_secure Off Off 

session.entropy_file no value no value 

session.entropy_length 0 0 

session.gc_divisor 100 100 

session.gc_maxlifetime 1440 1440 

session.gc_probability 1 1 

session.name PHPSESSID PHPSESSID 

session.referer_check no value no value 

session.save_handler files files 

session.save_path /tmp /tmp 

session.serialize_handler php php 

session.use_cookies On On 

session.use_only_cookies Off Off 

session.use_trans_sid Off Off 

shmop

shmop support  enabled  

sockets

Sockets Support  enabled  

standard

Regex Library  Bundled library enabled  

Dynamic Library Support  enabled  

Path to sendmail  /usr/sbin/sendmail -t -i  

Directive Local Value Master Value 

assert.active 1 1 

assert.bail 0 0 

assert.callback no value no value 

assert.quiet_eval 0 0 

assert.warning 1 1 

auto_detect_line_endings 0 0 

default_socket_timeout 60 60 

safe_mode_allowed_env_vars PHP_ PHP_ 

safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH 

url_rewriter.tags a=href,area=href,frame=src,input=src,form=,fieldset= a=href,area=href,frame=src,input=src,form=,fieldset= 

user_agent no value no value 

swf

swf support  enabled  

sybase

Sybase Support  enabled  

Allow Persistent Links  Yes  

Persistent Links  0/unlimited  

Total Links  0/unlimited  

Application Name  PHP 4.0  

Client API Version  $Id: dblib.c,v 1.116 2003/01/26 10:27:35 freddy77 Exp $  

tokenizer

Tokenizer Support  enabled  

wddx

WDDX Support enabled 

WDDX Session Serializer  enabled  

xml

XML Support  active  

XML Namespace Support  active  

EXPAT Version  1.95.6  

xmlrpc

core library version  xmlrpc-epi v. 0.51  

php extension version  0.51  

author  Dan Libby  

homepage  http://xmlrpc-epi.sourceforge.net  

open sourced by  Epinions.com  

xslt

XSLT support  enabled  

Backend  Sablotron  

Sablotron Version  1.0  

Sablotron Information  Cflags: -march=pentium4 -O3 -pipe -funroll-loops -fomit-frame-pointer Libs: -L/usr/lib -lexpat Prefix: /usr  

yp

YP Support  enabled  

zlib

ZLib Support  enabled  

Compiled Version  1.1.4  

Linked Version  1.1.4  

Directive Local Value Master Value 

zlib.output_compression Off Off 

zlib.output_compression_level -1 -1 

zlib.output_handler no value no value 

Additional Modules

Module Name 

dbase 

filepro 

sysvsem 

sysvshm 

Environment

Variable Value 

PATH  /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/opt/interbase/bin:.:/root/bin:.:/root/bin  

ORACLE_HOME  /usr/oracle/10.1.0.2/client  

PHP Variables

Variable Value 

_SERVER["UNIQUE_ID"] ZiFnqH8AAAEAAE85scEAAABA 

_SERVER["ORACLE_HOME"] /usr/lib/oracle/10.1.0.2/client 

_SERVER["TNS_ADMIN"] /usr/lib/oracle/10.1.0.2/client/network/admin 

_SERVER["LD_LIBRARY_PATH"] /usr/lib:/usr/apache2/lib:/usr/oracle/10.1.0.2/client/lib 

_SERVER["ORA_NLS33"] /usr/lib/oracle/10.1.0.2/client/nls/admin/data 

_SERVER["ORACLE_SID"] SUPRTPRD 

_SERVER["ORACLE_BASE"] /usr/lib/oracle 

_SERVER["LD_PRELOAD"] /usr/lib:/usr/apache2/lib:/usr/oracle/10.1.0.2/client/lib 

_SERVER["NLS_LANG"] AMERICAN_AMERICA.WE8ISO8859P1 

_SERVER["HTTP_ACCEPT"] image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, application/x-shockwave-flash, */* 

_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us 

_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate 

_SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705) 

_SERVER["HTTP_HOST"] ssvs3 

_SERVER["HTTP_CONNECTION"] Keep-Alive 

_SERVER["PATH"] /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/opt/interbase/bin:.:/root/bin:.:/root/bin 

_SERVER["SERVER_SIGNATURE"] <address>Apache/2.0.49 (Gentoo/Linux) mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6 Server at ssvs3 Port 80</address>  

_SERVER["SERVER_SOFTWARE"] Apache/2.0.49 (Gentoo/Linux) mod_ssl/2.0.49 OpenSSL/0.9.7d PHP/4.3.6 

_SERVER["SERVER_NAME"] ssvs3 

_SERVER["SERVER_ADDR"] 172.16.81.46 

_SERVER["SERVER_PORT"] 80 

_SERVER["REMOTE_ADDR"] 172.16.81.104 

_SERVER["DOCUMENT_ROOT"] /var/www/localhost/htdocs 

_SERVER["SERVER_ADMIN"] root@localhost 

_SERVER["SCRIPT_FILENAME"] /var/www/localhost/htdocs/info.php 

_SERVER["REMOTE_PORT"] 4001 

_SERVER["GATEWAY_INTERFACE"] CGI/1.1 

_SERVER["SERVER_PROTOCOL"] HTTP/1.1 

_SERVER["REQUEST_METHOD"] GET 

_SERVER["QUERY_STRING"] no value 

_SERVER["REQUEST_URI"] /info.php 

_SERVER["SCRIPT_NAME"] /info.php 

_SERVER["PHP_SELF"] /info.php 

_SERVER["PATH_TRANSLATED"] /var/www/localhost/htdocs/info.php 

_SERVER["argv"] Array

(

)

 

_SERVER["argc"] 0 

_ENV["PATH"] /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/opt/interbase/bin:.:/root/bin:.:/root/bin 

PHP License

This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE 

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net. 

 

1

2

```

Anyone have any ideas? I've beat my head against this for way too long at this point...  :Sad: 

TIA-

James

----------

## Ladius

Make sure that you have defined ORACLE_HOME=/something/here in the environment variables of your Apache2 startup script.

Here is my /etc/init.d/apache2 file notice the added oracle home env setting.

```
start() {

        checkconfig || return 1

        ebegin "Starting apache2"

        [ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache

        env -i PATH=$PATH  ORACLE_HOME=/opt/app/oracle/product/10.1.0/db_1 \

        /sbin/start-stop-daemon --quiet \

                --start --startas /usr/sbin/apache2 \

                --pidfile ${PIDFILE} -- -k start ${APACHE2_OPTS}

        eend $?

}

```

Your oracle php should work like a charm after this. I've not found a lot on oracle and php but you may find the following resources useful:

http://www.orafaq.com/faqphp.htm

http://www.faqts.com/knowledge_base/index.phtml/fid/15

----------

## ausmusj1

Already have the environment variables set for Apache. Take a look at the output from phpino() above:

```

Apache Environment 

Variable Value 

...

ORACLE_HOME  /usr/lib/oracle/10.1.0.2/client  

TNS_ADMIN  /usr/lib/oracle/10.1.0.2/client/network/admin  

LD_LIBRARY_PATH  /usr/lib:/usr/apache2/lib:/usr/oracle/10.1.0.2/client/lib

ORA_NLS33  /usr/lib/oracle/10.1.0.2/client/nls/admin/data  

ORACLE_SID  SUPRTPRD  

ORACLE_BASE  /usr/lib/oracle  

LD_PRELOAD  /usr/lib:/usr/apache2/lib:/usr/oracle/10.1.0.2/client/lib  

NLS_LANG  AMERICAN_AMERICA.WE8ISO8859P1 

...

```

So, as you can see, it still doesn't work...  :Sad: 

However, I was able to get the error text to be found properly, so I am now getting the same error, except with the correct error message:

```

Warning: ocilogon(): _oci_open_server: ORA-12154: TNS:could not resolve the connect identifier specified in /var/www/localhost/htdocs/fccorders/includes/testdb.php on line 19

```

It is definately a naming/name resolution issue, but I just can't get it to work properly...

Any other ideas?

-James

----------

## Ladius

Checkout this website at oracle: 

http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars

Given the code snippet you posted above I'm not seeing any export ORACLE_HOME lines. Where are you setting the environment varibles?

----------

## ausmusj1

I tried setting and exporting the environment variables in the /usr/sbin/apache2ctl shell script file, in the /etc/init.d/apache2 file, but none of those places would actually get Apache2 to "know" above the environment variables, contrary to everything that everyone posts...  :Smile: 

However, I was able to set the environment variables in the commonapache2.conf file in /etc/apache2/conf, using the SetEnv directive, and then Apache2 does recognize the environment variables, and passes them properly to php.

The code snippet that I had posted was actually output from the phpinfo() command, showing that Apache2 is actually propogating the ORACLE_HOME et al variables to the php module, so Apache2 and PHP definitely have awareness of all the Oracle environment vars...

----------

## ausmusj1

Has anyone here ever actually successfully gotten the Oracle 10g client working with Apache2 and PHP? I'm thinking about just un-installing the 10g client and throwing the 9i client on, as I've gotten that combination to work successfully before, but if someone else has had success specifically with 10g+Apache2+PHP, I'll keep hammering on this setup...

-James

----------

## ausmusj1

:bump:

----------

## DamianHole

Hi ausmusj1,

Try --enable-sigchild on your PHP configure line.

Damian.

----------

## ausmusj1

Thanks! I'll give it a try when I get back to work on Tuesday... I'll let you know what happens.

-James

----------

## ausmusj1

OK, that worked, sort of... Now I get intermittant results when connecting to any Oracle database   :Shocked:  . One try it will give me a "12154 - Can't Resolve TNS Name" error, then if I hit refresh, it will come up fine. Other times it will come up fine the first try, then fail if I hit refresh...

However, if I use the "EZCONNECT" naming, it works every single time...

One thing to note: Connecting via PHP or SQL*Plus on the command line works like a charm every time, using either TNSNAMES or EZCONNECT...

For the time being, I'm going to just convert all of the hosted PHP to use EZCONNECT naming. However, I would love to eventually get down to the bottom of this wierd intermittent issue! Any other thoughts from anyone?

-James

----------

## DamianHole

Hi James,

Glad to know the --enable-sigchild help.

With your other problem, it'd be worth checking your tnsnames.ora is in your TNS_ADMIN directory.

Damian.

----------

## ausmusj1

Hi-

tnsnames.ora file is good, have verified it. Some of the time, Apache2+PHP even recognizes that fact and it works fine. Other times, it doesn't work, however...

-James

----------

## DamianHole

g'day,

I wonder if it's related to PHP (or it's supporting libraries) not being thread-safe. The only ways to test this, would be to execute PHP as CGI, or try it with Apache1.

Damian.

----------

## fintan

I've seen the same problem on 2 rh 9 box's with 9i client installed in work. I think it has something to do with apache not always setting the env varible's. 

Either that or php is'nt doing what it suppose to. The scripts run without any problem if I restart apache before running them. After the 2 or 3 time it craps out.

----------

