Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-06-30
5
Medium Priority
?
258 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

885 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