Solved

PHP 5.0 and Oracle 9i database  connectivity problem on Win XP operating system

Posted on 2006-06-30
5
250 Views
Last Modified: 2013-12-12

Hi All,
         We are trying to connect to oracle 9i database from a PHP program using 2 methods. The methods are mentioned below.  We also tried these 2 methods using environmental variables too (mentioned below). But nothing worked.

Our configuration details are:
Operating system: MS Windows XP
PHP: PHP 5.0
Web server : IIS 5.0
Database: Oracle 9i database is installed on a remote machine.

We have Oracle 9i client installed and configured on our Windows XP machine. We are able to connect to the remote Oracle 9i database using Sql Plus editor.

We have placed the php_oci8.dll and php_oracle.dll files in the “C:\PHP\ext\” folder and uncommented the php.ini file like

extension=php_oci8.dll
extension=php_oracle.dll

and also have set the extension_dir = "C:\PHP\ext" in the php.ini file.


The error that we are getting is:
Fatal error: Call to undefined function OCILogon() in c:\Inetpub\wwwroot\php-eg\ora.php on line 24
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_oci8.dll' - Access is denied. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_oracle.dll' - Access is denied. in Unknown on line 0


•      Would you please guide us how to proceed to the next to get database connectivity?
•      Do we need any other dlls?
•      Does PHP 5.0 can talk to Oracle 9i and Oracle 10 g databases?


Method 1:
<?php

if ($c=OCILogon("wistest", "wisdomleaf", "dev1")) {
  echo "Successfully connected to Oracle.\n";
  OCILogoff($c);
} else {
  $err = OCIError();
  echo "Oracle Connect Error " . $err[text];
}

?>


Method 2:
<?php

if ($c=ora_logon("wistest@dev1","wisdomleaf")) {
  echo "Successfully connected to Oracle.\n";
  ora_commitoff($c);
  ora_logoff($c);
} else {
  echo "Oracle Connect Error " . ora_error();
}

?>


Environment Variables:
PutEnv("ORACLE_SID=dev");
PutEnv("ORACLE_HOME=/usr/ora92/product/9.2");
PutEnv("TNS_ADMIN=/usr/ora92/product/9.2/network/admin");



0
Comment
Question by:Anupama_2005
  • 2
5 Comments
 

Author Comment

by:Anupama_2005
ID: 17017871
Hi,
       I also tried by keeping the php_oci8.dll and php_oracle.dll  files in system, and system32 folders too.  But nothing worked
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 17017885
You will need to grant IUSR (I think) permissions to the extensions.

I would grant the webserver read access to the C:\PHP folder and all sub-folders.

0
 
LVL 40

Accepted Solution

by:
RQuadling earned 500 total points
ID: 17017892
Go to the command line.
Change directory to the C:\php
Type

PHP -m

This will report back all modules that PHP has been configured to run.

Any load errors will also appear.

I suspect you will not get any errors with the command line.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now