note 36808 added to function.ocilogon

From: Date: Thu, 23 Oct 2003 10:39:55 +0000
Subject: note 36808 added to function.ocilogon
Groups: php.notes 
Request: Send a blank email to php-notes+get-59162@lists.php.net to get a copy of this message
I've had all kinds of errors with RedHat9(yuck), PHP 4.3.4RC1 and Oracle enterprice server 9.2. For some time I thought that --with-oci8 wouldn't work with Oracle9 but that wasn't the case, the solution was many steps. 1) install oracle, might require some tricks, on RedHat9 I had to put this in my .bashrc: export ORACLE_BASE=/opt/ora9 export ORACLE_HOME=$ORACLE_BASE/product/9.2 export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_OWNER=oracle export ORACLE_SID=netadmdb export ORACLE_TERM=vt100 export LD_ASSUME_KERNEL=2.4.1 export THREADS_FLAG=native export LD_LIBRARY_PATH=$ORACLE_BASE/product/9.2/lib:$LD_LIBRARY_PATH 2) compile php, use --with-oci8 3) Make an init-script for the oracle9 database server, as default the TNS listener doesn't run so add that on aswell, example: #!/bin/bash export ORACLE_HOME=/opt/ora9/product/9.2 export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=netadmdb export DISPLAY=:0 oracle_user=oracle export oracle_user case $1 in start) su - "$oracle_user"<<EOO sqlplus /nolog<<EOS connect / as sysdba startup EOS /opt/ora9/product/9.2/bin/lsnrctl start EOO ;; stop) su - "$oracle_user"<<EOO /opt/ora9/product/9.2/bin/lsnrctl stop sqlplus /nolog<<EOS connect / as sysdba shutdown immediate EOS EOO ;; *) echo "Usage: ora9 [start|stop]" ;; esac 4) Configure Apache. For some reason it requires some tweaking with environment variables, in the begining I put those in the PHP-script with putenv, later in the httpd.conf with SetEnv and the mod_env module. But I was told to not do that and instead set them in the init script for Apache. So I copied apachectl to /etc/init.d and edited envvars in $APACHE_PATH/bin. First I added all kinds of env variables until I got it to work, and then I removed them one at a time and came to the following minimal configuration: LD_LIBRARY_PATH="/usr/local/apache2/lib:$LD_LIBRARY_PATH" ORACLE_HOME=/opt/ora9/product/9.2 LANG=sv_SE export LD_LIBRARY_PATH ORACLE_HOME LANG Earlier I had added NLS_LANG and TNS_ADMIN above those mentioned above (point 1), but it seems those aren't needed really. So no need for TWO_TASK or ORACLE_SID, only needed one is ORACLE_HOME and if you get missing/invalid option for your OCILogon set LANG to something else like I did. Someone earlier said it might have to do with UTF8. So if you are sure lsncrtl are started and that you have the correct env-variables set in your $APACHE_PATH/bin/envvars you can just use something like: $iDBConn=OCILogon("user","pass","netadmdb"); in your PHP-script and it should work. Hope this helps someone. ---- Manual Page -- http://www.php.net/manual/en/function.ocilogon.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36808 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36808&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36808&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59162) next »