Connect to Oracle database

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Connect to Oracle database

Postby surkum » 10. November 2008 08:28

Hi Everybody,
I've installed XAMP 1.6.8 and running of apache 2.2.9 and PHP 5.2.6 versions. I tried to connect a Oracle database from PHP and for that I have done the following:

1) Installed Oracle10g R2 client

2) Uncomment the following lines in xamp/apache/bin/php.ini file.
extension=php_oracle.dll
extension=php_oci8.dll

But I unable to get OCI detail in phpinfo page, also the oci_connect function giving errors....

Please help me to solve this...

Thanks
-Suresh.
surkum
 
Posts: 3
Joined: 10. November 2008 08:15

Postby Sharley » 10. November 2008 09:15

php_oracle.dll is deprecated, see below - so you can delete that extension or comment it out again.

You can uncomment these also:
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll


Did you save the php.ini file then restart Apache?


Some useful reading here.
Chris Jones wrote:The php_oci8.dll and php_pdo_oci.dll extensions require Oracle 10g client libraries. You can get the Oracle Instant Client (it's free) if your current libraries are older.

The php_pdo_oci8.dll extension is built to work with Oracle 8+ client libraries.

The php_oracle.dll extension is deprecated.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Still struggling...

Postby surkum » 11. November 2008 03:16

Hi Sharly,
Thank you for the reply.

I did these additional changes. But Still I cannot get OCI information on phpinfo page.

I am using the following simple code to test the connection.

<?php
$conn = oci_connect('username', 'password', 'servicename');
if (!$conn){
$e = oci_error();
print htmlentities($e['message']);
exit;
}
else{
echo 'Connection Success!!.';
}
?>

and the error output is,
Fatal error: Call to undefined function oci_connect() in C:\xampp\htdocs\test\oci8_test.php on line ...

Any more configurations-settings to be done? How can I troubleshoot this?
surkum
 
Posts: 3
Joined: 10. November 2008 08:15

Postby Sharley » 11. November 2008 04:49

surkum wrote:I did these additional changes. But Still I cannot get OCI information on phpinfo page.

Thats very strange.

Did you save the php.ini file then restart the Apache server?

Go to phpinfo() page from here:
http://localhost/xampp/phpinfo.php
and look for this line:
Loaded Configuration File

What path does it tell you?


I know it's no consolation but when I uncomment the oracle extensions in my php.ini file in the apache\bin folder they show up in my phpinfo() file and I don't even have Oracle installed on my PC.



Your simple php code at this stage is not relevant to having the php extensions show in the phpinfo() file.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Postby surkum » 11. November 2008 09:23

Yes. I restarted the Apache. Now following two windows alert messages coming one by one (each 2 times).

"This application failed to start because OCIW32.dll was not found. Re-installing the application may fix this problem."

"This application failed to start because OCI.dll was not found. Re-installing the application may fix this problem."

In http://localhost/xampp/phpinfo.php shows its configuration file path as,
Loaded Configuration File C:\xampp\apache\bin\php.ini

When I uncomment mysql stuff, the information about mysql is not coming in the phpinfo page.(Hence, the file I'm editing is correct). I observed that, in that php.ini file, there are some blocks for database severs and I could not found any pre defined block for OCI. This is the block detail for mysql...

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off


Should I have such a block of code for oci8??

Is there any installation order? (I, first installed Oracle client and then XAMPP)

:cry: :oops:
surkum
 
Posts: 3
Joined: 10. November 2008 08:15

Postby Sharley » 11. November 2008 10:46

surkum wrote:Yes. I restarted the Apache. Now following two windows alert messages coming one by one (each 2 times).

"This application failed to start because OCIW32.dll was not found. Re-installing the application may fix this problem."

"This application failed to start because OCI.dll was not found. Re-installing the application may fix this problem."
Look in the Windows Event Viewer to see if there is more info on those errors as I don't know what application is not starting.
In XP go to start>Administrative Tools>Event Viewer
Those 2 files are not part of XAMPP so must belong to your Oracle Client and so Oracle may also be corrupt but that is only an assumption.

surkum wrote:In http://localhost/xampp/phpinfo.php shows its configuration file path as,
Loaded Configuration File C:\xampp\apache\bin\php.ini
Thats is correct and what I was hoping to see.

surkum wrote:Should I have such a block of code for oci8??
There is no code block in php.ini for Oracle.

surkum wrote:Is there any installation order? (I, first installed Oracle client and then XAMPP)
Not that I am aware of as I believe that you would configure Oracle after install to tell it where things are but I have no knowlege of Oracle.

There is a possibility that XAMPP has been corrupted during install, which can happen.

The reason I say that is because even without having Oracle installed you should still be able to uncomment the oci extensions in the php.ini file and have them appear in the phpinfo() file.

Important - This is the issue that has to be resolved first or you will not be able to connect via XAMPP's php to your Oracle databases.

So may I suggest you uninstall the current XAMPP - first, make sure that all XAMPP components are stopped and any XAMPP components running as a service are also stopped (uninstall the service) including the XAMPP control Panel, then you can simply delete the XAMPP folder.

Download a fresh copy of XAMPP but I also suggest perhaps using the 7Zip or the Zip archive version then simply extract the archive to the folder of choice, usually C:\xampp as you had it before, but not using the Windows Installer version - just follow the installation instructions on the XAMPP For Windows web site page.

This method may help eliminate any possible issues by using the Windows Installer version.

Uninstalling and then reinstalling XAMPP has been known to fix some of these strange happenings in XAMPP.

So in conclusion we must fix the uncommented extension issue as they must be visible in the phpinfo() file before we can proceed to deal with any Oracle issues - as I said before they should be visible even if you don't have Oracle installed.

Some reading from a Google search here:
http://www.google.com/search?q=php_oci8.dll
http://www.google.com/search?q=php_pdo_oci8.dll

http://forums.oracle.com/forums/forum.jspa?forumID=178
http://www.oracle.com/community/index.html
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

call to undefined function oci_connect

Postby rsknowles » 18. November 2008 16:08

I have a similar problem. xampp installed trying to connect to oracle database. When running php_info() I can see the oci8 module loaded but when trying to connect to oracle i receive a "call to undefined function oci_connect" error.

oci8

OCI8 Support enabled
Version 1.2.5
Revision $Revision: 1.269.2.16.2.43 $
Active Persistent Connections 0
Active Connections 0
Temporary Lob support enabled
Collections support enabled

Directive Local Value Master Value
oci8.default_prefetch 10 10
oci8.max_persistent -1 -1
oci8.old_oci_close_semantics 0 0
oci8.persistent_timeout -1 -1
oci8.ping_interval 60 60
oci8.privileged_connect Off Off
oci8.statement_cache_size 20 20


Any advice? I'm stumped.
rsknowles
 
Posts: 2
Joined: 18. November 2008 16:03

Re: call to undefined function oci_connect

Postby rsknowles » 18. November 2008 23:14

I resolved my connection problem by granting read/execute permission on the BIN folder in my oracle home directory.
rsknowles
 
Posts: 2
Joined: 18. November 2008 16:03

remove PHP

Postby ScreamForMe » 01. December 2008 21:22

I had PHP installed in addition to XAMPP on my PC and removing PHP got rid of the the "This application failed to start because OCI.dll was not found. Re-installing the application may fix this problem." error.

Hope this helps someone
what the heck is a Joomla?
ScreamForMe
 
Posts: 1
Joined: 01. December 2008 21:19


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 44 guests