PHP OCI8 
July 17th, 2005, 04:00 AM
| | | |
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 :( | 
July 17th, 2005, 04:00 AM
| | | | re: PHP OCI8
On Fri, 06 Feb 2004 12:49:06 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
[color=blue]
>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.[/color]
Stop - and put it back where it was. Once you start fiddling with an Oracle
install like this, Bad Things Happen.
[color=blue]
>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Ē.[/color]
Hm, not a good sign.
[color=blue]
>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?[/color]
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 <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space> | 
July 17th, 2005, 04:00 AM
| | | | re: PHP OCI8
On Sat, 07 Feb 2004 12:59:11 +0000, Andy Hassall <andy@andyh.co.uk>
wrote:
[color=blue]
>On Fri, 06 Feb 2004 12:49:06 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
>[color=green]
>>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.[/color]
>
> Stop - and put it back where it was. Once you start fiddling with an Oracle
>install like this, Bad Things Happen.
>[color=green]
>>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Ē.[/color]
>
> Hm, not a good sign.
>[color=green]
>>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?[/color]
>
> 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?[/color]
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 | 
July 17th, 2005, 04:00 AM
| | | | re: PHP OCI8
On Fri, 06 Feb 2004 20:13:13 +0100, "PIII450@HOME.NL"
<PIII450@HOME.NL> wrote:
[color=blue]
>On Sat, 07 Feb 2004 12:59:11 +0000, Andy Hassall <andy@andyh.co.uk>
>wrote:
>[color=green]
>>On Fri, 06 Feb 2004 12:49:06 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
>>[color=darkred]
>>>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.[/color]
>>
>> Stop - and put it back where it was. Once you start fiddling with an Oracle
>>install like this, Bad Things Happen.
>>[color=darkred]
>>>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Ē.[/color]
>>
>> Hm, not a good sign.
>>[color=darkred]
>>>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?[/color]
>>
>> 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?[/color]
>[/color]
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 :) | 
July 17th, 2005, 04:01 AM
| | | | re: PHP OCI8
On Fri, 06 Feb 2004 20:27:14 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
[color=blue]
>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 :)[/color]
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 <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space> | 
July 17th, 2005, 04:02 AM
| | | | re: PHP OCI8
On Sun, 08 Feb 2004 22:06:03 +0000, Andy Hassall <andy@andyh.co.uk>
wrote:
[color=blue]
>On Fri, 06 Feb 2004 20:27:14 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
>[color=green]
>>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 :)[/color]
>
> 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>[/color]
I'll give it a go tomorrow and tell you what happened :))
Thanks so far.
Roger | 
July 17th, 2005, 04:03 AM
| | | | re: PHP OCI8
On Sat, 07 Feb 2004 23:49:40 +0100, "PIII450@HOME.NL"
<PIII450@HOME.NL> wrote:
[color=blue]
>On Sun, 08 Feb 2004 22:06:03 +0000, Andy Hassall <andy@andyh.co.uk>
>wrote:
>[color=green]
>>On Fri, 06 Feb 2004 20:27:14 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
>>[color=darkred]
>>>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 :)[/color]
>>
>> 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>[/color]
>
>I'll give it a go tomorrow and tell you what happened :))
>
>Thanks so far.
>
>Roger[/color]
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. | 
July 17th, 2005, 04:15 AM
| | | | re: PHP OCI8
> Thanks for your help and the lesson learned? Always reboot M$[color=blue]
> Windblows after installing or changing something.[/color]
That or learn how to setup stuff right in the first place --- bad carpenter
will always blame his tools .... | 
July 17th, 2005, 04:15 AM
| | | | re: PHP OCI8
On Sun, 08 Feb 2004 21:27:54 +0100, "PIII450@HOME.NL" <PIII450@HOME.NL> wrote:
[color=blue]
>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.[/color]
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 <andy@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space> |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|