Solved

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

Posted on 2006-06-30
5
249 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 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

12 Experts available now in Live!

Get 1:1 Help Now