Here is my configuration
jason@home:~$
jason@home:~$ free
total used free shared buffers
cached
Mem: 3075856 866608 2209248 0 12532
668632
-/+ buffers/cache: 185444 2890412
Swap: 578300 0 578300
jason@home:~$ uname -a
Linux home 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686
GNU/Linux
jason@home:~$ php --version
PHP 5.2.1 (cli) (built: Jul 17 2007 18:14:23)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
jason@home:~$
jason@home:/var/www$ php testoci.php
Logon OK
jason@home:/var/www$
jason@home:/var/www$
jason@home:/var/www$ cat testoci.php
<?php
require_once('DB.php');
# $db=DB::connect("oci8://scott:tiger@orcl");
$db=OCILogon("scott","tiger","orcl");
if (!DB::iserror($db))
{
echo "\r\nLogon OK\n";
}
else
{
echo "\r\nLogon NOT OK\r\n";
#echo $db->getDebugInfo();
}
?>
jason@home:/var/www$
jason@home:/var/www$ sqlplus scott/tiger@orcl
SQL*Plus: Release 11.1.0.6.0 - Production on Thu Aug 30 16:22:42 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing
options
SQL>
When I execute testoci.php from the command line like I show above, I
see "Logon OK" like I show above.
When I execute this program from http://localhost/testoci.php I see
Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed.
There is something wrong with your system - please check that
ORACLE_HOME is set and points to the right directory in /var/www/
testoci.php on line 4
Logon OK
I don't understand it. In my Apache startup script, I have added echo
$ORACLE_HOME >/1.lst. When I reboot the computer, and examine this
file, it shows /oracle/test11g which is my Oracle home.
In a separate thread last year (http://www.thescripts.com/forum/
thread454404.html), Mladen suggests (for Oracle 10.2) trying "chmod -R
o+rx $ORACLE_HOME" but this doesn't work either. I am using 11g.
If anyone can suggest what else to test, I would be most greatful.
Thank you
Jason
Just one more thing, please post to the sig. This is just a junk e-
mail account so I can avoid getting spammed on my real one.
OK, let's see
>
>
> Here is my configuration
>
> jason@home:~$
> jason@home:~$ free
> total used free shared buffers
> cached
> Mem: 3075856 866608 2209248 0 12532
> 668632
> -/+ buffers/cache: 185444 2890412
> Swap: 578300 0 578300
> jason@home:~$ uname -a
> Linux home 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686
> GNU/Linux
This is an unofficial build. My FC7 has kernel 2.6.22, the official RH
4.0 kernel version is much lower:
[oracle@oracle12 install]$ uname -a
Linux oracle12 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686
i686 i386 GNU/Linux
[oracle@oracle12 install]$
[oracle@oracle12 install]$ cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
You are probably using something like CentOS 5. In case of an unofficial
build, setup must be checked very carefully. On the other side, I didn't
have any trouble with installing 11g on my FC7.
> Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed.
> There is something wrong with your system - please check that
> ORACLE_HOME is set and points to the right directory in /var/www/
> testoci.php on line 4
> Logon OK
Oracle 11g doesn't protect $ORACLE_HOME the way 10g used to do. The
script, used by 10g to to remove that protection, is now gone. The
script used to be named $ORACLE_HOME/install/changePerm.sh. It is,
however, likely that there is some problem with file protection.
Unfortunately, you will have to use "strace -af -e trace=file" to find
out what that is.
>
>
> I don't understand it. In my Apache startup script, I have added echo
> $ORACLE_HOME >/1.lst. When I reboot the computer, and examine this
> file, it shows /oracle/test11g which is my Oracle home.
You should also add LD_LIBRARY_PATH. Add the following in the
/etc/init.d/httpd:
export ORACLE_HOME=/ORACLE/app/oracle/product/11g
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
Make sure that this is added before the call to apachectl.
> You should also add LD_LIBRARY_PATH. Add the following in the
> /etc/init.d/httpd:
> export ORACLE_HOME=/ORACLE/app/oracle/product/11g export
> LD_LIBRARY_PATH=$ORACLE_HOME/lib
BTW, PHP-5.2.4, available as of today, correctly reports oracle version
as ˝11.1˝
$ php -r 'phpinfo();'|egrep -i 'oci|oracle'
Configure Command => './configure' '--with-apxs2=/usr/sbin/apxs' '--
with-xmlrpc' '--with-zlib' '--with-bz2' '--with-ttf' '--with-gd' '--
enable-gd-native-ttf' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-
dir' '--with-config-file-path=/usr/local/lib/php' '--enable-sigchild' '--
without-sqlite' '--disable-mysql' '--disable-pdo' '--with-oci8=/oracle/
product/11.1.0'
oci8
OCI8 Support => enabled
Oracle Version => 11.1
Compile-time ORACLE_HOME => /oracle/product/11.1.0
oci8.default_prefetch => 10 => 10
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => 0 => 0
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
LD_LIBRARY_PATH => /oracle/product/11.1.0/lib
ORACLE_HOME => /oracle/product/11.1.0
> LD_LIBRARY_PATH=$ORACLE_HOME/lib
Adding to my apache startup script makes no difference, sadly.
> This is an unofficial build. My FC7 has kernel 2.6.22, the official RH
> 4.0 kernel version is much lower:
> [oracle@oracle12 install]$ uname -a
> Linux oracle12 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686
> i686 i386 GNU/Linux
> [oracle@oracle12 install]$
> [oracle@oracle12 install]$ cat /etc/redhat-release
> Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
>
Dammit you've caught me out! I am running Ubuntu 7.04 setup according
to recent instructions from HJR. Ubuntu is a great distribution that
I'm sticking to. I realise I'm on my own and as it's only a home
learning development environment, it's fine. Work is running 10.1 and
I'm jsut jumping the gun a little.
I will look at the strace option when I figure out what it does and
fix the argument syntax for Ubuntu. Thank you Mladen for pointing me
in the right direction.
Jason
root@home:/#
root@home:/# strace -af -e all trace=file
strace: trace=file: command not found
root@home:/#
root@home:/#
Ubuntu is totally new for me and take almost two days to install the
Oracle 11g database on it.
But the Oracle DB and php works well with the Ubuntu. I can use
conncet DB through command line and firefox
Here is my configuration:
Ubuntu:
#sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 7.04
Release: 7.04
Codename: feisty
Oracle: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 -
Production
PHP: PHP 5.2.4 (cli)
Apache: Apache/2.2.4 (Unix)
You can try the whole installation again!
There is a gudie on http://www.dizwell.com/prod/node/929 , please
follow it.
"The Underground PHP and Oracle® Manual" can guide you to install the
php and apache correctly.
Goods luck!
Hi Jason. When I encounter problems like this, the first thing I do is
read the warning or error message.
> Warning: ocilogon() [function.ocilogon]: OCIEnvNlsCreate()
> failed. There is something wrong with your system - please
> check that ORACLE_HOME is set and points to the right directory in
> /var/www/testoci.php on line 4
Add
echo "ORACLE_HOME=".getenv("ORACLE_HOME");
to your PHP script report what you see in the browser. If you don't
see "ORACLE_HOME=your oracle home" then you have your answer.
Regards
Mike
TESSELLA Michae...@tessella.com
__/__/__/ Tessella Support Services plc
__/__/__/ 3 Vineyard Chambers, ABINGDON, OX14 3PX, England
__/__/__/ Tel: (44)(0)1235-555511 Fax: (44)(0)1235-553301
www.tessella.com Registered in England No. 1466429