PHP Configuration Oci8

Source: Internet
Author: User
Tags zend

1. Download Oracle Client rpm

Instant Client for Linux http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

Oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64
Oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64

$rpm-IVH oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm

$rpm-IVH oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm

Here the next two will be able to then install

The. So file is generated in this directory

/usr/lib/oracle/11.2/client64/lib

$ls/usr/lib/oracle/11.2/client64/lib

$echo/usr/lib/oracle/11.2/client64/lib/>/etc/ld.so.conf.d/oracle_client.conf

At the this point, you ' re ready to register your newly-installed libraries:

$ldconfig-V

2. Configure Phpize

The downloaded version will be the same as the PHP version, or it won't fit.

Http://rpm.pbone.net/index.php3/stat/4/idpl/24668595/dir/scientific_linux_6/com/php-devel-5.3.3-26.el6.x86_64.rpm.html

php-devel-5.3.3-26 x86_64 Download

Phpize, a build tool that prepares the build environment for PHP extensions.

[Email protected] tmp]# RPM-IVH php-devel-5.3.3-26.el6.x86_64.rpm

Warning:php-devel-5.3.3-26.el6.x86_64.rpm:header V4 dsa/sha1 Signature, key ID 192a7d7d:nokey

Preparing ... ########################################### [100%]

1:php-devel ########################################### [100%]

[Email protected] tmp]# Whereis phpize

Phpize:/usr/bin/phpize/usr/share/man/man1/phpize.1.gz

3. Configure Oci8

Https://pecl.php.net/package/oci8 oci8 Download

[[Email protected] oci]# CD

Oci8-1.3.3/oci8-1.3.3.tgz package.xml

[Email protected] oci]# CD oci8-1.3.3

[[email protected] oci8-1.3.3]# ls

CONFIG.M4 CREDITS oci8_collection.c oci8_interface.c oci8_statement.c php_oci8_int.h tests

Config.w32 oci8.c oci8.dsp oci8_lob.c php_oci8.h README

[Email protected] oci8-1.3.3]# phpize

Configuring for:

PHP Api version:20090626

Zend Module Api no:20090626

Zend Extension Api no:220090626

When prompted, enter either the value of $ORACLE _home, or Instantclient,/path/to/instant/client/lib.

Note:do not enter the variable $ORACLE _home because it won't be expanded. Instead, enter the actual path of the Oracle home directory.

If using an rpm-based installation of Oracle Instant Client, the Configure line would look like this:

./configure--with-oci8=shared,instantclient,/usr/lib/oracle/<version>/client/lib

For example, --with-oci8=shared,instantclient,/usr/lib/oracle/12.1/client/lib

Note that Oracle Instant Client support first appeared in PHP 4.3.11 and 5.0.4 and originally used the option --with-o Ci8-instant-client to configure PHP.

[Email protected] oci8-1.3.3]# ./configure-with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client64/ Lib

....

Checking for CC option to produce PIC ...-fpic-dpic

Checking if cc PIC flag-fpic-dpic works ... yes

Checking if cc static flag-static works ... no

Checking if cc supports-c-o file.o ... yes

Checking if cc supports-c-o file.o ... (cached) Yes

Checking whether the CC linker (/usr/bin/ld-m elf_x86_64) supports GKFX libraries ... yes

Checking WHETHER-LC should is explicitly linked in ... No

Checking dynamic linker characteristics ... Gnu/linux ld.so

Checking how to HardCode library paths into programs ... immediate

Checking whether stripping libraries is possible ... yes

Checking if Libtool supports shared libraries ... yes

Checking whether to build shared libraries ... yes

Checking whether to build static libraries ... no

Configure:creating./config.status

Config.status:creating config.h

config.status:executing Libtool Commands

Make install

Libraries has been installed in:

/tmp/oci/oci8-1.3.3/modules

If you ever happen to want to link against installed libraries

In a given directory, Libdir, you must either use Libtool, and

Specify the pathname of the library, or use the '-llibdir '

Flag during linking and do at least one of the following:

-Add Libdir to the ' Ld_library_path ' environment variable

During execution

-Add Libdir to the ' Ld_run_path ' environment variable

During linking

-Use the '-WL,-RPATH-WL,LIBDIR ' linker flag

-Your system administrator add Libdir to '/etc/ld.so.conf '

See all operating system documentation about GKFX libraries for

More information, such as the LD (1) and ld.so (8) manual pages.

----------------------------------------------------------------------

Installing Shared extensions:/usr/lib64/php/modules/

$echo extension=oci8.so >/etc/php.d/oci8.ini

$/ETC/INIT.D/HTTPD restart

The official documentation for the installation of Oci8 is as follows:

http://php.net/manual/en/oci8.installation.php

4. Verify that PHP can connect to the Oracle database:

You can see the information in the Phpinfo oci8 module has been loaded

[Email protected] html]# more get_dbinfo.php
<?php
$db _connect = oci_connect (' system ', ' xxx ', ' (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1
30.131) (PORT = 1521)) (Connect_data = (SERVER = dedicated) (service_name = Deff)));

$sql _query = Oci_parse ($db _connect, ' Select status from V$instance ');
Oci_execute ($sql _query,oci_default);
# #echo $sql _query
while ($r =oci_fetch_row ($sql _query))
{
echo $r [0];
echo "<BR>";
}
?>
[[email protected] html]# PHP get_dbinfo.php
Open<br>[[email protected] html]#

Here, the configuration of PHP is all done, and then there is something about PHP and the database that are combined with the shell script to make the HTML interface.

=============ended============

PHP Configuration Oci8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.