Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-06-30
5
Medium Priority
?
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

688 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