Operating System - OpenVMS
1753386 Members
6121 Online
108792 Solutions
New Discussion юеВ

Re: CSWS/PHP Oracle9 connectivity

 
berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

Martin, Milan,

According to a post in google comp.os.vms group, it seems that the HP CSWS/PHP installation and released notes doc is false.

We have to define PHP$OCI_SHR and not APACHE$OCI_SHR in login.com in order APACHE/PHP to work with OCI.

The right syntax for Oracle 9i seems to be something like :
define php$oci_shr ora_root:[lib32]libclntsh.so
Martin Vorlaender
Honored Contributor

Re: CSWS/PHP Oracle9 connectivity

Hi,

I dug a little deeper inside the application development docs, and found that linking is documented as by using ORA_UTIL:LOUTL.COM. On my Oracle8 system the link with shared OCI image in that DCL procedure references ORA_OLB:ORACLIENT.OPT, which contains the line "ora_util:oraclient_V817/shareable".

So for my system, ORACLIENT_V817.EXE seems to be the right shareable image. YMMV with your V9.

cu,
Martin
berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

Here's my situation at that time (after 3 days of hard work... lol)

that's what i've done in apache$www login.com.
$!
$ @ora_root:[000000]orauser
$!
$ define php$oci_shr ora_root:[lib32]libclntsh.so
$ define apache$oci_shr ora_root:[lib32]libclntsh.so
$ define php$oci_pfx " "
$ !


Here's my php/oracle test script :
putenv("ORACLE_HOME=dka0:[produit.oracle]");
putenv("ORACLE_SID=PC1CA2");
putenv("LD_LIBRARY_PATH=dka0:[produit.oracle.lib32]");
putenv("TNS_ADMIN=dka0:[produit.oracle.network.admin]tnsnames.ora");
putenv("TWO_TASK=dka0:[produit.oracle.network.admin]tnsnames.ora");
putenv("ORACLE_BASE=dka0:[produit]");
$username = "valerie";
$paswd = "bei";
$db ="(DESCRIPTION =
(ADDRESS =
(PROTO = TCP)
(HOST = PC1CA2)
(PORT = 1521)
)
(CONNECT_DATA = (SID = PC1CA2))
)";
echo "

Attempting database connection...

";
$db_conn = ocinlogon($username, $paswd, $db);
if (!$db_conn)
{
echo "...FAILED. Check the username, passwd, dbstring given in this script are valid or not.

";
if (OCIError($db_conn))
{
$erra=OCIError($db_conn);
dodberror("SQL Error: $erra[code] $erra[message]");
}
exit;
}
else
{
echo "

Connected...

";
}

$stmt = ociparse($db_conn, "select type_op,nom_op from acces");
if (!$stmt)
{
echo '

parsing error

';
}
if (!ociexecute($stmt,OCI_DEFAULT))
{
echo "

query execute error!

";
}
echo "\n";
$ncols = OCINumCols($stmt);
echo "\n";

for ($i = 1; $i <= $ncols; $i++) {
$column_name = OCIColumnName($stmt,$i);
echo "\n";
}

while (OCIFetch($stmt))
{
echo "\n";
for ($i = 1; $i <= $ncols; $i++)
{
$column_value = OCIResult($stmt,$i);
echo "\n";
}
echo "\n";
}

echo "\n";
echo "
$column_name
$column_value
\n";



OCIFreeStatement($stmt);
OCILogoff($db_conn);


Now my php script connect to the database but i've a strange error when i'm
strying to select data
When drawn out from bases column is of type int (number) all is ok.
Data are presented on page, but when I drawing out of given type
Varchar (eg. name) then it doesn't work (white page without ORA error)!
I've tried to modify NLS_LANG environnement variable without any success, but
an Ora 12705 Invalid or unknown NLS parameter value specified.
What's the trouble ? environment problem ? NLS problem ? OCI pb ?

What is the best way to define environment variable : in login.com ? in php script ?

I need a way...
Bojan Nemec
Honored Contributor

Re: CSWS/PHP Oracle9 connectivity

Berlioz,

In php putenv is probably a wrapper arround the C function putenv. This comes from the *NIX world. This function works fith environment variables which dont exist in VMS. The closest to this are VMS symbols. But the VMS setenv and putenv does not set any VMS symbols! The values set by these routines are visible only from the program.

Maybe you can debug what is defined using the php function passthru() (passthru("show symbol/all") and passthru ("show logical")).

But if you define all symbols and logical names in login.com this will work.

Bojan
berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

Bojan,

it's true that it's work better when i define logical in login.com

actually, my problem seems to be an "oracle nls" problem while trying to retrive data from char and varchar value.
berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

YES !!!!!!

i've ****** solved my problem !!! (sorry but i've loose 4 days)

The problem is in login.com

don't invoke orauser.com, but just define ORACLE_HOME, ORACLE_SID and ORA_NLS33

And !!!! show must go on !!!

Thanks for all