469,648 Members | 1,557 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

ociExecute() dies silent on CGI mode php.

Hello.
It's rainy day of winter in here. :(

I install php on AIX, with OCI8 ext.
WebServer is WebtoB, WAS is JEUS.
There was a problem on compiling (oci.h is not found) and linking.
(machine was 32bit system, but default oracle library path
/tmax/oracle/client/lib is for 64bit)
Anyway, i fixed Makefile and php work well with OCI on CLI.
This is my script.

#!/usr/local/bin/php -f
<?php
$conn = ociLogon('scott', 'tiger', 'testdb');
$stmt = ociParse($conn, "SELECT COUNT(*), MAX(entry_date) FROM
ct_abbr");
ociExecute($stmt);
if (ociFetch($stmt)) {
echo "COUNT(*) : ", ociResult($stmt, 1), "\n";
echo "MAX(entry_date) : ", ociResult($stmt, 2), "\n";
ociFreeStatement($stmt);
}
ociLogoff($conn);
?>

When I run ./oci.php, It shows good result.

COUNT(*) : 9364
MAX(entry_date) : 20060213

But I try to access it via web, it doesn't work.
First i found environmental variables aren't set.
so modified source to add puenv()

<?php
ini_set("display_errors", 1);

$ORACLE_BASE = "/tmax/oracle";
$ORACLE_HOME = "$ORACLE_BASE/client";
$PATH = getenv("PATH") . ":$ORACLE_HOME/bin";
$LD_LIBRARY_PATH = "$ORACLE_HOME/lib";
$TNS_ADMIN = "$ORACLE_HOME/network/admin";
$NLS_LANG = "American_america.KO16KSC5601";

putenv("ORACLE_BASE=$ORACLE_BASE");
putenv("ORACLE_HOME=$ORACLE_HOME");
putenv("PATH=$PATH");
putenv("LD_LIBRARY_PATH=$LD_LIBRARY_PATH");
putenv("TNS_ADMIN=$TNS_ADMIN");
putenv("NLS_LANG=$NLS_LANG");

$que = "SELECT COUNT(*), MAX(entry_date) FROM ct_abbr";

$conn = ociLogon('scott', 'tiger', 'testdb'); //exit($stmt);
$stmt = ociParse($conn, $que); //exit($stmt);
ociExecute($stmt);exit($stmt);
if (ociFetch($stmt)) {
echo "COUNT(*) : ", ociResult($stmt, 1), "\n";
echo "MAX(entry_date) : ", ociResult($stmt, 2), "\n";
ociFreeStatement($stmt);
}
ociLogoff($conn);
?>

This script work until ociParse().
But if ociExecute() is called, browser show white page.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type
content="text/html; charset=ks_c_5601-1987"></HEAD>
<BODY></BODY></HTML>

I don't know why it work on cli, but not on cgi.
(phpinfo() show Server API is cgi)
Please help me...

Feb 14 '06 #1
2 2106
On Mon, 13 Feb 2006 19:26:53 -0800, LeaFriend wrote:
$conn = ociLogon('scott', 'tiger', 'testdb'); //exit($stmt); $stmt =
ociParse($conn, $que); //exit($stmt);
ociExecute($stmt);exit($stmt);

^^^^^^^^^^^
Very odd. This should be commented out, no?

--
Ben.

Feb 14 '06 #2
That's not commented,
If exit($stmt) is run, then 'Resource #...' should be printed,
but browser show 'page not found'.
It doesn't show blank white page anymore... :(

Feb 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by TThai | last post: by
3 posts views Thread by Li Pang | last post: by
1 post views Thread by eelisdotnet | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.