Oracle, php and a Fog of Confusion oci_connect

Martin McCormick martin at dc.cis.okstate.edu
Wed Jul 1 21:57:41 UTC 2009


I have a fragment of php code which connects to an external
Oracle data base. It looks mostly like:

   <?php
   //open connection to database
   $conn = oci_connect("db_name", "PASS_WORD",
   "host.name.OKSTATE.EDU");
     if (!$conn) {
      $e = oci_error();
      print htmlentities($e['message']);
      exit;
     }
   ?>

	We have had php5 installed on the system in question for
a couple of years and just successfully installed
linux-oracle-instantclient-sqlplus.

	The info from php says it understands shared libraries.

	If I run the code fragment via php using a script
starting with
#! /usr/local/bin/php

I get
#
Fatal error: Call to undefined function oci_connect() in /usr/home/martin/tmp/qtest on line 4

I am not terribly surprised since, unless a shared library
changed, php is the same old php we have had all this time.

	Basically, I am confused as to what I need to do next to
weld the tail on the donkey.:-) Somehow, this all has to fit
together to produce the connection to the Oracle server.

	The linux-oracle-instantclient-sqlplus  pkg-descr file
says:

Oracle instant client - SQLPlus distribution

Instant Client allows you to run your applications without installing
the standard Oracle client or having an ORACLE_HOME.  OCI, OCCI, ODBC,
and JDBC applications work without modification, while using
significantly less disk space than before.  Even SQL*Plus can be used
with Instant Client.  No recompile, no hassle.

	Any suggestion? Obviously the php application hasn't
gotten wind of the instantclient yet.

Martin McCormick
Systems Engineer
405 744-7572   Stillwater, OK
Information Technology Department
Telecommunications Services Group


More information about the freebsd-questions mailing list