Solved

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

Posted on 2006-06-30
5
252 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:Richard Quadling
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:
Richard Quadling 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

828 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