469,328 Members | 1,251 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

PHP OCI8

Hi all,

We had to switch to windows 2003 server with IIS and now i've got a
problem with the OCI8 :(( Big time!

I know php works. I have tested this.
I know the oracle\bin is in the path. I checked.

At first I just made the extension active and then PHP stopped. Pages
wouldn't load and the IIS had to be restarted.

Eventhouh the oracle\bin was in the path I took out the oci.dll
because I know oci8.dll looks for it and put it in the windows dir.
Now PHP would work again and the phpinfo() tells me the OCI extenion
has been loaded.

Now I really want to use oracle and the first thing I encounter is:

Warning: ocilogon(): _oci_open_server: S in F:\web\exp\testORA.php on
line 10

No clear error message just some garbage. In this case S.

I made the complete oracle directory read and execute, at first for
the IUSR user and later on for Everyone but that din't help. I know I
must be missing something and that's why I asking you.

Any suggestions?

TIA

Roger who lost a week up to now :(

Jul 17 '05 #1
8 19150
On Fri, 06 Feb 2004 12:49:06 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
We had to switch to windows 2003 server with IIS and now i've got a
problem with the OCI8 :(( Big time!

I know php works. I have tested this.
I know the oracle\bin is in the path. I checked.

At first I just made the extension active and then PHP stopped. Pages
wouldn't load and the IIS had to be restarted.

Eventhouh the oracle\bin was in the path I took out the oci.dll
because I know oci8.dll looks for it and put it in the windows dir.
Stop - and put it back where it was. Once you start fiddling with an Oracle
install like this, Bad Things Happen.
Now PHP would work again and the phpinfo() tells me the OCI extenion
has been loaded.

Now I really want to use oracle and the first thing I encounter is:

Warning: ocilogon(): _oci_open_server: S in F:\web\exp\testORA.php on
line 10

No clear error message just some garbage. In this case S.
Hm, not a good sign.
I made the complete oracle directory read and execute, at first for
the IUSR user and later on for Everyone but that din't help. I know I
must be missing something and that's why I asking you.

Any suggestions?


What version of Oracle and PHP?

As for the permissions, as well as Read and Execute I've got List Folder
Contents as well (makes sense since it might want to look for localised message
files?)

Do you have more than one Oracle home on the system?

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #2
On Sat, 07 Feb 2004 12:59:11 +0000, Andy Hassall <an**@andyh.co.uk>
wrote:
On Fri, 06 Feb 2004 12:49:06 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
We had to switch to windows 2003 server with IIS and now i've got a
problem with the OCI8 :(( Big time!

I know php works. I have tested this.
I know the oracle\bin is in the path. I checked.

At first I just made the extension active and then PHP stopped. Pages
wouldn't load and the IIS had to be restarted.

Eventhouh the oracle\bin was in the path I took out the oci.dll
because I know oci8.dll looks for it and put it in the windows dir.


Stop - and put it back where it was. Once you start fiddling with an Oracle
install like this, Bad Things Happen.
Now PHP would work again and the phpinfo() tells me the OCI extenion
has been loaded.

Now I really want to use oracle and the first thing I encounter is:

Warning: ocilogon(): _oci_open_server: S in F:\web\exp\testORA.php on
line 10

No clear error message just some garbage. In this case S.


Hm, not a good sign.
I made the complete oracle directory read and execute, at first for
the IUSR user and later on for Everyone but that din't help. I know I
must be missing something and that's why I asking you.

Any suggestions?


What version of Oracle and PHP?

As for the permissions, as well as Read and Execute I've got List Folder
Contents as well (makes sense since it might want to look for localised message
files?)

Do you have more than one Oracle home on the system?


I'ts Oracle 9i and php 4.3.3 and eventhough I didn't mention it the
first time I did give them the list right as well. So maybe this
little extra info can help.

Thanks.

Roger
Jul 17 '05 #3
On Fri, 06 Feb 2004 20:13:13 +0100, "PI*****@HOME.NL"
<PI*****@HOME.NL> wrote:
On Sat, 07 Feb 2004 12:59:11 +0000, Andy Hassall <an**@andyh.co.uk>
wrote:
On Fri, 06 Feb 2004 12:49:06 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
We had to switch to windows 2003 server with IIS and now i've got a
problem with the OCI8 :(( Big time!

I know php works. I have tested this.
I know the oracle\bin is in the path. I checked.

At first I just made the extension active and then PHP stopped. Pages
wouldn't load and the IIS had to be restarted.

Eventhouh the oracle\bin was in the path I took out the oci.dll
because I know oci8.dll looks for it and put it in the windows dir.


Stop - and put it back where it was. Once you start fiddling with an Oracle
install like this, Bad Things Happen.
Now PHP would work again and the phpinfo() tells me the OCI extenion
has been loaded.

Now I really want to use oracle and the first thing I encounter is:

Warning: ocilogon(): _oci_open_server: S in F:\web\exp\testORA.php on
line 10

No clear error message just some garbage. In this case S.


Hm, not a good sign.
I made the complete oracle directory read and execute, at first for
the IUSR user and later on for Everyone but that din't help. I know I
must be missing something and that's why I asking you.

Any suggestions?


What version of Oracle and PHP?

As for the permissions, as well as Read and Execute I've got List Folder
Contents as well (makes sense since it might want to look for localised message
files?)

Do you have more than one Oracle home on the system?

I'ts Oracle 9i and php 4.3.3 and eventhough I didn't mention it the
first time I did give them the list right as well. So maybe this
little extra info can help.

Thanks.

Roger

And only 1 home :)
Jul 17 '05 #4
On Fri, 06 Feb 2004 20:27:14 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
I'ts Oracle 9i and php 4.3.3 and eventhough I didn't mention it the
first time I did give them the list right as well. So maybe this
little extra info can help.

And only 1 home :)


It's often best to trim everything down to basics when it starts Doing Weird
Things. The corrupted-looking message probably qualifies as weird.

A checklist off the top of my head, if you post replies to each point at least
it'll show where you stand:

(1) Environment:

What's in PATH?

echo $_ENV['PATH'];

Where's your Oracle home?

echo $_ENV['ORACLE_HOME'];

Although this may well not be set, since you're not actually supposed to set
ORACLE_HOME under Windows, unlike under Unix. (Oracle stores various bits of
information in the registry instead).

Others:

echo $_ENV['TNS_ADMIN'];
echo $_ENV['NLS_LANG'];

(2) Does sqlplus work from the command line?

sqlplus username/password@database

< do some stuff like select sysdate from dual >

(3) Does sqlplus work from PHP?

<pre>
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open("sqlplus test/test@dev92lnx", $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], "select sysdate from dual;\n");
fclose($pipes[0]);

while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
$return_value = proc_close($process);

echo "command returned $return_value\n";
}
?>
</pre>

(4) What does a minimal OCI8 example do? (alter username/password/database as
necessary):

<pre>
<?php
putenv("NLS_LANG=ENGLISH_UNITED KINGDOM.WE8ISO8859P1");

if (!$conn = OCILogon("test","test","dev92lnx")) {
$err = OCIError();
die($err['message']);
}

print "<hr>Server Version: " . OCIServerVersion($conn) . "<hr>";

if (!$stmt = OCIParse($conn,"
select sysdate from dual
")) {
$err = OCIError();
die($err['message']);
}

if (!OCIExecute($stmt)) {
$err = OCIError();
die($err['message']);
}

while (OCIFetchInto($stmt, $row, OCI_ASSOC+OCI_RETURN_NULLS)) {
print_r($row);
}

OCIFreeStatement($stmt);
OCILogoff($conn);
?>
</pre>

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #5
On Sun, 08 Feb 2004 22:06:03 +0000, Andy Hassall <an**@andyh.co.uk>
wrote:
On Fri, 06 Feb 2004 20:27:14 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
I'ts Oracle 9i and php 4.3.3 and eventhough I didn't mention it the
first time I did give them the list right as well. So maybe this
little extra info can help.

And only 1 home :)


It's often best to trim everything down to basics when it starts Doing Weird
Things. The corrupted-looking message probably qualifies as weird.

A checklist off the top of my head, if you post replies to each point at least
it'll show where you stand:

(1) Environment:

What's in PATH?

echo $_ENV['PATH'];

Where's your Oracle home?

echo $_ENV['ORACLE_HOME'];

Although this may well not be set, since you're not actually supposed to set
ORACLE_HOME under Windows, unlike under Unix. (Oracle stores various bits of
information in the registry instead).

Others:

echo $_ENV['TNS_ADMIN'];
echo $_ENV['NLS_LANG'];

(2) Does sqlplus work from the command line?

sqlplus username/password@database

< do some stuff like select sysdate from dual >

(3) Does sqlplus work from PHP?

<pre>
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open("sqlplus test/test@dev92lnx", $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], "select sysdate from dual;\n");
fclose($pipes[0]);

while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
$return_value = proc_close($process);

echo "command returned $return_value\n";
}
?>
</pre>

(4) What does a minimal OCI8 example do? (alter username/password/database as
necessary):

<pre>
<?php
putenv("NLS_LANG=ENGLISH_UNITED KINGDOM.WE8ISO8859P1");

if (!$conn = OCILogon("test","test","dev92lnx")) {
$err = OCIError();
die($err['message']);
}

print "<hr>Server Version: " . OCIServerVersion($conn) . "<hr>";

if (!$stmt = OCIParse($conn,"
select sysdate from dual
")) {
$err = OCIError();
die($err['message']);
}

if (!OCIExecute($stmt)) {
$err = OCIError();
die($err['message']);
}

while (OCIFetchInto($stmt, $row, OCI_ASSOC+OCI_RETURN_NULLS)) {
print_r($row);
}

OCIFreeStatement($stmt);
OCILogoff($conn);
?>
</pre>


I'll give it a go tomorrow and tell you what happened :))

Thanks so far.

Roger
Jul 17 '05 #6
On Sat, 07 Feb 2004 23:49:40 +0100, "PI*****@HOME.NL"
<PI*****@HOME.NL> wrote:
On Sun, 08 Feb 2004 22:06:03 +0000, Andy Hassall <an**@andyh.co.uk>
wrote:
On Fri, 06 Feb 2004 20:27:14 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
I'ts Oracle 9i and php 4.3.3 and eventhough I didn't mention it the
first time I did give them the list right as well. So maybe this
little extra info can help.

And only 1 home :)


It's often best to trim everything down to basics when it starts Doing Weird
Things. The corrupted-looking message probably qualifies as weird.

A checklist off the top of my head, if you post replies to each point at least
it'll show where you stand:

(1) Environment:

What's in PATH?

echo $_ENV['PATH'];

Where's your Oracle home?

echo $_ENV['ORACLE_HOME'];

Although this may well not be set, since you're not actually supposed to set
ORACLE_HOME under Windows, unlike under Unix. (Oracle stores various bits of
information in the registry instead).

Others:

echo $_ENV['TNS_ADMIN'];
echo $_ENV['NLS_LANG'];

(2) Does sqlplus work from the command line?

sqlplus username/password@database

< do some stuff like select sysdate from dual >

(3) Does sqlplus work from PHP?

<pre>
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open("sqlplus test/test@dev92lnx", $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], "select sysdate from dual;\n");
fclose($pipes[0]);

while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
$return_value = proc_close($process);

echo "command returned $return_value\n";
}
?>
</pre>

(4) What does a minimal OCI8 example do? (alter username/password/database as
necessary):

<pre>
<?php
putenv("NLS_LANG=ENGLISH_UNITED KINGDOM.WE8ISO8859P1");

if (!$conn = OCILogon("test","test","dev92lnx")) {
$err = OCIError();
die($err['message']);
}

print "<hr>Server Version: " . OCIServerVersion($conn) . "<hr>";

if (!$stmt = OCIParse($conn,"
select sysdate from dual
")) {
$err = OCIError();
die($err['message']);
}

if (!OCIExecute($stmt)) {
$err = OCIError();
die($err['message']);
}

while (OCIFetchInto($stmt, $row, OCI_ASSOC+OCI_RETURN_NULLS)) {
print_r($row);
}

OCIFreeStatement($stmt);
OCILogoff($conn);
?>
</pre>


I'll give it a go tomorrow and tell you what happened :))

Thanks so far.

Roger


I found it :)) It all started with the $_ENV['PATH'] you suggested.
The above mentioned occurred on 2 machines. When I did the set in a
command windows the ora\bin was in the PATH. When I looked at the
$_ENV['PATH'] it wasn't. Don't ask me why but just restarting IIS and
loading php again didn't do the trick. A reboot of the server was
needed. Afterwards PHP and OCI worked on 1 of the machines :)) When I
took a closer look the second machine had a second ora home. Don't ask
me why but those idiots from Atos installed oracle twice. I added the
second ora\bin to the PATH, rebooted the machine and now this one is
working as well :))

Thanks for your help and the lesson learned? Always reboot M$
Windblows after installing or changing something.
Jul 17 '05 #7
> Thanks for your help and the lesson learned? Always reboot M$
Windblows after installing or changing something.


That or learn how to setup stuff right in the first place --- bad carpenter
will always blame his tools ....
Jul 17 '05 #8
On Sun, 08 Feb 2004 21:27:54 +0100, "PI*****@HOME.NL" <PI*****@HOME.NL> wrote:
When I did the set in a
command windows the ora\bin was in the PATH. When I looked at the
$_ENV['PATH'] it wasn't. Don't ask me why but just restarting IIS and
loading php again didn't do the trick.


IIS runs as a child of the IIS Admin service. This then runs as a child of
SERVICES.EXE. Processes inherit environment from their parent. Since you can't
really stop SERVICES.EXE without the system going tits up, changing the
environment seen by IIS without a reboot appears tricky, as changing the
environment for your command prompt or the system has no effect on other
already-running processes.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ollivier Robert | last post: by
reply views Thread by lok | last post: by
3 posts views Thread by Chad The Man | last post: by
1 post views Thread by watayoune | last post: by
reply views Thread by RDahlstedt | last post: by
4 posts views Thread by cyrano | last post: by
5 posts views Thread by Mladen Gogala | last post: by
7 posts views Thread by eholz1 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.