0

I'm developing a PHP API that connects to an Oracle database, but unfortunately the connection does not work. First of all, I implemented the development environment (oracle database server + apache server), all well configured, I guess. The problem is that I do not get any response from the code I wrote, even when I type incorrect data.

PHP Info oci8:

[rvieira@localhost ~]$ php --ri oci8
oci8
OCI8 Support => enabled
Version => 1.4.10
Revision => $Id: 44bfa713983a99b3e59477f6532e5fb51b6dee94 $
Active Persistent Connections => 0
Active Connections => 0
Oracle Run-time Client Library Version => 11.2.0.2.0
Oracle Instant Client Version => 11.2
Temporary Lob support => enabled
Collections support => enabled
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off

PHP Code:

<?php
$connection = oci_connect('sys', 'rvieira', 'localhost/xe');

if (!$connection) {
   $m = oci_error();
   echo $m['message'], "\n";
   exit;
}
else {
   print "Connected to Oracle!";
}
?>

I also leave here the tutorials that I followed to configure the development environment:

kero
  • 10,647
  • 5
  • 41
  • 51
Waterlog
  • 36
  • 1
  • 4
  • 1
    Have you looked at your server logs? They should tell you what is happening. –  Oct 13 '13 at 21:58
  • Well, I decided to run the php file via CLI and it runs and works, however, in the browser does not work. :| http://alojaimagens.com/images/9grkq2kylfgaaiksbd.png – Waterlog Oct 13 '13 at 22:20
  • Mike W here it is: [Sun Oct 13 23:24:55 2013] [error] [client 127.0.0.1] PHP Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804\n in /var/www/html/api.php on line 2 [Sun Oct 13 23:25:12 2013] [error] [client 127.0.0.1] PHP Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in /var/www/html/api.php on line 2 – Waterlog Oct 13 '13 at 22:31

1 Answers1

1

Your error message suggests that there is a problem with the environment variable LD_LIBRARY_PATH, but doesn't detail exactly what. Setting this is covered in step 6 of "Enabling the PHP OCI8 Extension on Linux", which you can find at your first link.

Double check your installation - you've probably missed something.