Oracle 11 g Instant Client is the easiest way to connect PHP to a remote Oracle database. 11 g Oracle Instant Client é a maneira mais fácil de conectar PHP para uma base de dados Oracle remoto. This notes describes how to install PHP with the OCI8 Extension and Oracle Instant Client on Windows and Linux. Esta nota descreve como instalar o PHP com o OCI8 Extensão e Oracle Instant Client em Windows e Linux. The free The Underground PHP and Oracle Manual contains more detail and explains other installation options. A livre Underground PHP e Oracle O Manual contém mais detalhes e explica outras opções de instalação.
OCI8 is the PHP extension for connecting to Oracle databases. OCI8 é a extensão PHP para ligação a bases de dados Oracle. (The name is copied from Oracle’s C “call interface” API interface first introduced in Oracle 8.) OCI8 is open source and included with PHP. (O nome é copiado a partir da Oracle C “chamada interface” Interface API introduzidas pela primeira vez em Oracle 8). OCI8 é open source e incluído com PHP.
Oracle Instant Client is a free set of easily installed libraries that allow programs to connect to Oracle databases. Oracle Instant Client é um conjunto de livre facilmente instalado bibliotecas que permitem que programas para conectar a bases de dados Oracle. To use Instant Client, an existing database is needed; Instant Client does not include one. Para usar o Instant Client, um banco de dados existente é necessária; Instant Client não incluir um. Typically the database will be on another machine. Normalmente o banco de dados estará em outra máquina. If the database is local then Oracle libraries will generally be accessible and Instant Client not required. Se o banco de dados é local, em seguida, Oracle bibliotecas serão geralmente acessíveis e Instant Client não exigida.
Using Instant Client 11 g , OCI8 functions work with Oracle 9.2, 10.x, and 11.x databases. Usando Instant Client 11 g, OCI8 funções trabalhar com Oracle 9.2, 10.x, 11.x e bases de dados. If OCI8 is compiled with Instant Client 10 g , connection to Oracle 8.1 is also possible. Se OCI8 é compilado com Instant Client 10 g, conexão à Oracle 8.1 é também possível.
Software Requirements: Software Requisitos:
Oracle Instant Client
Apache HTTPD Server
PHP – PHP Hypertext Processor
Enabling the PHP OCI8 Extension on Windows Habilitar o PHP OCI8 Extension no Windows
The Instant Client binaries complement PHP’s prebuilt binaries for Windows. O Instant Client binários PHP complemento da pré binários para Windows.
- Download the Apache HTTPD Server and the Windows PHP 5.2 zip package . Faça o download do Apache HTTPD Server eo Windows PHP 5,2 zip pacote. Use the “Non-thread-safe” version of PHP if you want to use Fast CGI, or use the default bundle if you plan to run PHP as an Apache module. Use o “Non-thread-safe” versão do PHP, se você quiser usar Fast CGI, ou usar o pacote padrão, se você pretende executar o PHP como um módulo Apache.
Install PHP and Apache following Installation on Windows Systems in the PHP Manual. Instale o PHP e Apache seguintes Instalação em sistemas Windows em PHP Manual.
Check that PHP is working before continuing. Verifique que PHP está funcionando antes de continuar. At this stage Oracle support is not enabled. Nesta fase o apoio Oracle não está ativado.
- Download the “Instant Client Package – Basic” for Windows from the OTN Instant Client page . Faça o download do “Instant Client Package – Basic” para o Windows a partir da OTN Instant Client página.
Unzip the Instant Client to c:\instantclient_11_1 Descompacte o Instant Client para c: \ instantclient_11_1
Edit the PATH environment setting and add c:\instantclient_11_1 before any other Oracle directories. Editar a configuração de ambiente PATH e adicione c: \ instantclient_11_1 antes de qualquer outra Oracle diretórios. For example, on Windows XP, follow Start -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list. Por exemplo, no Windows XP, siga Iniciar -> Painel de Controle -> Sistema -> Avançadas -> Variáveis de Ambiente e editar PATH no Sistema variáveis lista.
Set desired Oracle globalization language environment variables such as NLS_LANG. Definir idioma desejado Oracle globalização variáveis do ambiente, tais como NLS_LANG. If nothing is set, a default local environment will be assumed. Se nada for definido, um padrão ambiente local serão assumidas. See An Overview on Globalizing Oracle PHP Applications for more details. Veja um resumo de Globalizing PHP Oracle Applications para obter mais detalhes.
Unset Oracle variables such as ORACLE_HOME and ORACLE_SID, which are unnecessary with Instant Client. Unset Oracle variáveis como ORACLE_HOME e ORACLE_SID, que são desnecessários com Instant Client.
- The default OCI8 1.2 extension included in PHP 5.2 has been superceded. O padrão OCI8 1/2 extensão incluído no PHP 5/2 foi superada. Whilst you could use it, I recommend downloading the OCI8 1.3 extension from Pierre Joye’s build page . Embora você pode utilizá-lo, eu recomendo fazer o download do OCI8 1,3 extensão de Pierre Joye construção da página. This download location is temporary while the PHP community develops a replacement for the pecl4win system. Este download é temporário, enquanto a localização PHP comunidade desenvolve um substituto para o pecl4win sistema.
The current OCI8 1.3 packages for PHP 5.2 are php_oci8-1.3.5-5.2-Win32-vc6-x86.zip and php_oci8-1.3.5-5.2-nts-Win32-vc6-x86.zip. O actual OCI8 1/3 pacotes para PHP 5.2 são php_oci8-1.3.5-5.2-win32-vc6-x86.zip e php_oci8-1.3.5-5.2-nts-Win32-vc6-x86.zip. Use the “nts” version if you installed a non-thread-safe PHP. Use o “nts” se você instalou uma versão não-thread-safe PHP. Each package contains a replacement php_oci8.dll and introduces a new php_oci8_11g.dll file. Cada pacote contém uma substituição php_oci8.dll e introduz um novo php_oci8_11g.dll arquivo.
Unzip the appropriate package and move the two DLLs to your extension directory, eg c:\php-5.2.9\ext. Descompacte o pacote adequado e mover as duas DLLs para a sua prorrogação diretório, por exemplo, c: \ php-5.2.9 \ ext.
- Edit php.ini and set extension_dir to the directory with the PHP extension DLLs: Editar php.ini extension_dir e definir para o diretório com a extensão PHP DLLs:
5. extension_dir=”c:\php-5.2.9\ext” extension_dir = “c: \ php-5.2.9 \ ext”
6.
Also in php.ini, enable the OCI8 extension with: Também em php.ini, habilite a extensão OCI8 com:
extension=php_oci8_11g.dll extension = php_oci8_11g.dll
If using Oracle 10.2 Instant Client, alternatively put: Se estiver usando Oracle Instant Client 10/2, alternativamente, colocar:
extension=php_oci8.dll extension = php_oci8.dll
Only one of the php_oci8.dll or php_oci8_11g.dll extensions can be enabled at any time. Apenas um dos php_oci8.dll ou extensões php_oci8_11g.dll pode ser ativada a qualquer momento. The extensions are mostly equivalent, but the 11g version supports Oracle DRCP connection pooling. As extensões são essencialmente equivalentes, mas o Oracle 11g versão suporta conexão DRCP agrupamento.
- Restart Apache. Reinicie o Apache.
Autor: Christopher Jones, Oracle Corporation
Email: christopher.jones@oracle.com Email: christopher.jones @ oracle.com
Updated: March 2009 Actualização: Março de 2009
FONTE: http://www.oracle.com/technology/pub/notes/technote_php_instant.html