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($stm t);
if (ociFetch($stmt )) {
echo "COUNT(*) : ", ociResult($stmt , 1), "\n";
echo "MAX(entry_date ) : ", ociResult($stmt , 2), "\n";
ociFreeStatemen t($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("displa y_errors", 1);
$ORACLE_BASE = "/tmax/oracle";
$ORACLE_HOME = "$ORACLE_BA SE/client";
$PATH = getenv("PATH") . ":$ORACLE_H OME/bin";
$LD_LIBRARY_PAT H = "$ORACLE_HO ME/lib";
$TNS_ADMIN = "$ORACLE_HO ME/network/admin";
$NLS_LANG = "American_ameri ca.KO16KSC5601" ;
putenv("ORACLE_ BASE=$ORACLE_BA SE");
putenv("ORACLE_ HOME=$ORACLE_HO ME");
putenv("PATH=$P ATH");
putenv("LD_LIBR ARY_PATH=$LD_LI BRARY_PATH");
putenv("TNS_ADM IN=$TNS_ADMIN") ;
putenv("NLS_LAN G=$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($stm t);exit($stmt);
if (ociFetch($stmt )) {
echo "COUNT(*) : ", ociResult($stmt , 1), "\n";
echo "MAX(entry_date ) : ", ociResult($stmt , 2), "\n";
ociFreeStatemen t($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_56 01-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...
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($stm t);
if (ociFetch($stmt )) {
echo "COUNT(*) : ", ociResult($stmt , 1), "\n";
echo "MAX(entry_date ) : ", ociResult($stmt , 2), "\n";
ociFreeStatemen t($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("displa y_errors", 1);
$ORACLE_BASE = "/tmax/oracle";
$ORACLE_HOME = "$ORACLE_BA SE/client";
$PATH = getenv("PATH") . ":$ORACLE_H OME/bin";
$LD_LIBRARY_PAT H = "$ORACLE_HO ME/lib";
$TNS_ADMIN = "$ORACLE_HO ME/network/admin";
$NLS_LANG = "American_ameri ca.KO16KSC5601" ;
putenv("ORACLE_ BASE=$ORACLE_BA SE");
putenv("ORACLE_ HOME=$ORACLE_HO ME");
putenv("PATH=$P ATH");
putenv("LD_LIBR ARY_PATH=$LD_LI BRARY_PATH");
putenv("TNS_ADM IN=$TNS_ADMIN") ;
putenv("NLS_LAN G=$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($stm t);exit($stmt);
if (ociFetch($stmt )) {
echo "COUNT(*) : ", ociResult($stmt , 1), "\n";
echo "MAX(entry_date ) : ", ociResult($stmt , 2), "\n";
ociFreeStatemen t($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_56 01-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...
Comment