Diff for "PHPOracle"


Differences between revisions 3 and 4
Revision 3 as of 2008-01-24 12:42:04
Size: 1773
Editor: 85
Comment: added zend core
Revision 4 as of 2008-06-27 10:15:31
Size: 1775
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 70: Line 70:
* [http://www.orafaq.com/wiki/PHP Oracle PHP Wiki] * [[http://www.orafaq.com/wiki/PHP|Oracle PHP Wiki]]

To be able to access Oracle databases from PHP, you will need to have PHP compiled / linked with the Oracle OCI (oci8) library . You could use the pre-built PHP 5 from Zend http://www.oracle.com/technology/tech/php/zendcore/index.html

or there are two other ways to get PHP working with OCI8:

  1. Install the Oracle Database [Oracle10g] [Oracle9i]
  2. Install Oracle Instant Client

If your Oracle database is in another machine, the Oracle Instant Client is a smaller install.

PHP using Oracle Database Server

TODO

PHP using Oracle Instant Client

Tested Environment:

Ubuntu Server 6.06 LTS Oracle Instant Client 10.2.0.2

Prerequisites:

sudo apt-get install build-essential
sudo apt-get install php5-dev php-pear

Also download the Oracle Instant Client http://www.oracle.com/technology/tech/oci/instantclient/index.html

You will need the Basic (34MB) and SDK (600K). The Basic Lite version does not work.

cd /usr/local/lib
sudo unzip <location-of-instant-client-basic>
sudo unzip <location-of-instant-client-sdk>
cd instantclient_10_2
sudo ln -s libclntsh.so.10.1 libclntsh.so

The symbolic link is needed by during the compilation step later.

sudo pecl install oci8

You will be prompted for the location of the library:

instantclient,/usr/local/lib/oracle_10_2

If successful, you may now add the following line at the bottom of php.ini

extension = oci8.so

The php.ini is found in 2 places: /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini

sudo /etc/init.d/apache2 reload

Check <?php echo phpinfo() ?> to verify if the OCI8 module is available.

Further Reading

* Oracle PHP Wiki

PHPOracle (last edited 2014-01-03 04:33:00 by 202)