downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Installation> <Installation/Configuration
[edit] Last updated: Fri, 10 Feb 2012

view this page in

Pré-requis

L'extension OCI8 nécessite les bibliothèques clientes 9iR2, 10g ou 11g. Si la base de données Oracle est sur la même machine que PHP, le logiciel de la base de données contient déjà toutes les bibliothèques nécessaires. Lorsque PHP est sur une machine différente, vous devez utilisez les bibliothèques libres » Oracle Instant Client.

Pour utiliser Oracle Instant Client, installez le fichier compressé basic ou basiclite de Oracle Instant Client ou le paquet RPM. Lorsque vous compilez PHP depuis ces sources, installez également le fichier compressé sdk ou le paquet RPM devel.

Sous Windows, la bibliothèque DLL php_oci8 requière les bibliothèques clientes depuis la version 10gR2 ou supérieure. En PHP 5.3, incluant PHP 5.3.5, la bibliothèque DLL php_oci8_11g requière les bibliothèques clientes Oracle 11gR1 ou supérieur. A partir de PHP 5.3.6, la bibliothèque DLL php_oci8_11g requière les bibliothèques clientes Oracle 11gR2 ou supérieur. Suivant la version du client Instant, vous pourriez également avoir besoin des bibliothèques mfc71.dll et msvcr71.dll.

Vous devriez exécuter PHP avec la même version (ou plus récente) des bibliothèques Oracle utilisées pour compiler OCI8.

Note:

Si OCI8 utilise les bibliothèques clientes 9iR2 ou 10g, alors PHP peut se connecter aux bases de données Oracle 8i, 9iR2, 10g ou 11g. Si OCI8 utilise les bibliothèques clientes 11g, la base de données peut être 9iR2, 10g ou 11g.

Note:

Le support de toutes les fonctionnalités OCI8 n'est disponible que lors de l'utilisation des versions les plus récentes des bibliothèques clientes mais aussi de la base de données la plus récente.



add a note add a note User Contributed Notes Pré-requis
Anonymous 10-Feb-2012 06:33
How to connect from PHP to an Oracle database using OID (Oracle Internet Directory):

OID is like a lookup index that contains connection strings for connecting to various databases. Without OID, a database connection string would be stored directly in the code settings and used by the PHP code to connect to a database. With OID, a lookup can be made to the OID LDAP to acquire the database connection string. Then the PHP code will use the acquired database connection string to connect to the database as before.

OID allows a DBA to manage/change which database server that an application uses without having to change any database settings in the PHP application itself or on the application server.

Here are the basic steps for PHP to connect to a database via OID:

- The DBA should provide you the connection information for the OID LDAP as well as the username/password for the database connection.
- Connect to the OID LDAP using the provided information
- Search for the appropriate LDAP record
- Get the connection string data from the record attribute, "orclnetdescstring"
- Close the LDAP connection
- Use the acquired connection string data to connect to the database as usual using the provided database username/password.

Here is basic sample code to do this:

// Get connection string from OID LDAP

    $ds=ldap_connect($servername,$serverport); // Connect to ldap
    $r=ldap_bind($ds); // Bind to ldap
    $sr = ldap_search($ds, "cn=OracleContext,dc=___,dc=___,dc=___", "cn=$sid"); // Run query
    $info = ldap_get_entries($ds, $sr); // Get entries
    ldap_close($ds); // Close connection

    $dbconnectstring = $info[0]["orclnetdescstring"][0]; // Extract db connect string from ldap search result array

// Connect to database using acquired connection string from OID

    $dbconnection = oci_connect ($username,$password,$dbconnectstring);
dha at octo dot com 05-Jan-2011 04:04
If you plan to use Oracle Internet Directory with LDAPS, you NEED to compile the php-ldap library with Oracle Support.

Also, with OID 10g I had to create a folder, reference it in the env variable $ORACLE_HOME, and copy in it three ldap message files found in my OID installation.

At the end, my $ORACLE_HOME looked like this :
ldap
  mesg
    ldapf.msb
    ldapus.msb
    ldapus.msg
   
(Note that the ldapf.msb is here because I have a french installation of OID)

To use ldaps, you will need to use ldap_connect this way :

ldap_connect(host,port,"file://path/to/wallet",walletpassword,sslauth)

Your wallet only needs to contain the CA (secure) certificate.

with sslauth being :
  1 for no ssl authentication
  32 for ssl server authentication
  64 for ssl mutual authentication

 
show source | credits | sitemap | contact | advertising | mirror sites