Operating System - OpenVMS
1828161 Members
2404 Online
109975 Solutions
New Discussion

Re: CSWS/PHP Oracle9 connectivity

 
berlioz
Regular Advisor

CSWS/PHP Oracle9 connectivity

Hello,

With CSWS 2 (apache)/PHP under OpenVMS 7.3.2 i'm actually trying to interface an Oracle 9i database located on the same server with no success.

In my php.ini i've uncommented "extension=php_oracle.exe"
In my apache$www:[000000]login.com i've added @orauser.com

But... no connexion at that time... (php:ora_logon failed)

Some can help me ?
thanks in advance for all

15 REPLIES 15
John Gillings
Honored Contributor

Re: CSWS/PHP Oracle9 connectivity

berlioz,

I'd expect the process to be running under username APACHE$WWW or similar. Is that username authorized to access the database? Is there some way for your end user to provide a username/password to be used to login?
A crucible of informative mistakes
Martin Vorlaender
Honored Contributor

Re: CSWS/PHP Oracle9 connectivity

From http://h71000.www7.hp.com/openvms/products/ips/apache/csws_php_relnotes.html#oci8ext I read that you need to define logical APACHE$OCI_SHR.

What does http://your.server/php/php_info.php say about Oracle connectivity (should appear in the "additional modules" section)?

cu,
Martin
berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

Martin,

About CSWS_PHP installation Guide and release notes, OCI8 extension :

The problem is that i'm currently using Oracle 9 and there's no ora_root:[UTIL] directory on my server. So i actually don't know how define APACHE$OCI_SHR logical...

But he documentation says that it works with any Oracle 8 and Oracle 9 database server, so i'm just looking for the right solution for Oracle 9

berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

and no ORACLIENT_Vxxx.EXE too
Martin Vorlaender
Honored Contributor

Re: CSWS/PHP Oracle9 connectivity

AFAIK, you have to install the client separately from the database.

And mind you: I'm no Oracle expert...

cu,
Martin
berlioz
Regular Advisor

Re: CSWS/PHP Oracle9 connectivity

Here's the output for php_info.php

ORACLE

Oracle Support enabled
Oracle Version no value
Compile-time ORACLE_HOME no value
Libraries Used no value

is it normal to have "no_value" for all oracle parameters ?

J.M
New Member

Re: CSWS/PHP Oracle9 connectivity

berlioz,

define APACHE$OCI_SHR as :[.lib32]libclntsh.so" and try again
Martin Vorlaender
Honored Contributor

Re: CSWS/PHP Oracle9 connectivity

berlioz,

I get the same output from php_info on a system here:

OpenVMS 7.2-1H1
CSWS 1.3
CSWS_PHP 1.1
ORACLE 8.1.7

And I *do* have an ORACLIENT_V817.EXE.
I've not yet tried to connect to the database

cu,
Martin
Daniel Fernandez Illan
Trusted Contributor

Re: CSWS/PHP Oracle9 connectivity

Hi Berlioz

If you need install some Oracle product you can use "oracleins" symbol (login with oracle user).

This procedure show a menu that allow install components of ORACLE, including UTIL directory.

Best regards
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