update : 2015.11.03
php.shukuma.com검색:
|
설치Configuring PHP with OCI8Review the previous Requirements section before configuring OCI8. To enable the OCI8 extension, configure PHP with the option --with-oci8 . Before starting the web server, OCI8 typically requires several Oracle environment variables (see below) to locate libraries, point to configuration files, and set some basic properties such as the character set used by Oracle libraries. The variables must be set before any PHP process starts. The PHP binary must link with the same, or more recent, major version of Oracle libraries as it was configured with. For example, if you build OCI8 with Oracle 11.2 libraries, then PHP should also be deployed and run with Oracle 11.2 libraries. PHP applications can connect to other versions of Oracle Database, since Oracle has client-server cross-version compatibility. Installing OCI8 as a Shared ExtensionThe configuration shared option builds OCI8 as a shared library that can be dynamically loaded into PHP. Building a shared extension allows OCI8 to be upgraded easily without impacting the rest of PHP. Configure OCI8 using one of the following configure options.
After configuration, follow the usual PHP building procedure, e.g. make install. The OCI8 shared extension oci8.so library will be created. It may need to be manually moved to the PHP extension directory, specified by the extension_dir option in your php.ini file. To complete installation of OCI8, edit php.ini and add the line:
extension=oci8.so Installing OCI8 as a Statically Compiled ExtensionConfigure PHP to include OCI8 using one of the following configure options.
After configuration, follow the usual PHP building procedure, e.g. make install. After successful compilation, you do not need to add oci8.so to php.ini. No additional build steps are required. Installing OCI8 from PECLThe OCI8 extension can be added to an existing PHP installation either automatically or manually from » PECL. For an automated install follow these steps:
For a manual install when the pecl command is not available, download the PECL OCI8 package, e.g. oci8-1.4.10.tgz.
After either an automatic or manual install, edit your php.ini file and add the line:
extension=oci8.so Make sure the php.ini directive extension_dir is set to the directory that oci8.so was installed in. Installing OCI8 on WindowsWhen using Oracle 10gR2 client libraries on Windows, uncomment the php.ini line extension=php_oci8.dll. When using Oracle 11gR2 or later client libraries, uncomment extension=php_oci8_11g.dll or extension=php_oci8.dll. With Oracle 12c libraries use extension=php_oci8_12c.dll or extension=php_oci8_11g.dll or extension=php_oci8.dll. Only one of these DLLs may be enabled at a time. DLLs with higher versions may contain more functionality. Not all DLLs may be available for all versions of PHP. Make sure extension_dir is set to the directory containing the PHP extension DLLs. If using Instant Client, set the system PATH environment variable to the Oracle library directory. Setting the Oracle EnvironmentBefore using this extension, make sure that the Oracle environment variables are properly set for the web daemon user. If your web server is automatically started at boot time then make sure that the boot-time environment is also configured correctly.
On Red Hat Linux and variants, export variables at the end of /etc/sysconfig/httpd. Other systems with Apache 2 may use an envvars script in the Apache bin directory. A third option, the Apache SetEnv directive in httpd.conf, may work in some systems but is known to be insufficient in others. To check that environment variables are set correctly, use phpinfo() and check the Environment (not the Apache Environment) section contains the expected variables. The variables that might be needed are included in the following table. Refer to the Oracle documentation for more information on all the available variables.
TroubleshootingThe most common problem with installing OCI8 is not having the Oracle environment correctly set. This typically appears as a problem using oci_connect() or oci_pconnect(). The error may be a PHP error such as Call to undefined function oci_connect(), an Oracle error such as ORA-12705, or even an Apache crash. Check the Apache log files for startup errors and see the sections above to resolve this problem. While network errors like ORA-12154 or ORA-12514 indicate an Oracle network naming or configuration issue, the root cause may be because the PHP environment is incorrectly set up and Oracle libraries are unable to locate the tnsnames.ora configuration file. On Windows, having multiple versions of Oracle on the one machine can easily cause library clashes unless care is taken to make sure PHP only uses the correct version of Oracle. A utility to examine what libraries are being looked for and loaded can help resolve missing or clashing library issues, particularly on Windows.
|