PHP5.3.27
PHP OCI8
Bước 1: Download mấy cái file instantclient Link
Lưu ý: kiểm tra xem OS là x86 hay x86_64, nếu down sai thì sẽ có lỗi
unzip instantclient-basic-linux-12.1.0.1.0.zip
unzip instantclient-odbc-linux-12.1.0.1.0.zip
unzip instantclient-sdk-linux-12.1.0.1.0.zip
Giải nén ra (các file sẽ nằm cùng một thư mục vd: /usr/local/src/instantclient_12_1)
cd vào mấy con vẹo
ln -s libclntsh.so.*.1 libclntsh.so
(với * là 10,11,12.. vv)
Bước 2: cài đặt OCI8
Download oci8: Link (vd: oci8-1.4.10.tgz)
tar xvzf oci8-1.4.10.tgz
/usr/local/php5/bin/phpize
./configure --with-oci8=instantclient,/usr/local/src/instantclient_12_1 --with-php-config=/usr/local/php5/bin/php-config
make && make install
Bước 3: cấu hình php.ini thêm
extension=oci8.so
PDO_OCI
fix erorr:
1. checking for oci.h... /x/x/x/x/include configure: error: I'm too dumb to figure out where the libraries are in your instant client install
2. configure: error: Unsupported Oracle version!
Bước 1: Download pdo_oci link
Bước 2: giải nén tar xvzf PDO_OCI-1.0.tgz
Bước 3: download config.mp4 patch: link
Bước 4: sửa config.m4 (để chạy với instantclient 12.1)
tìm line: SUPPORTED_LIB_VERS="9.0 10.1 11.1" # This caters for all Oracle 9.x, 10.x and 11.1 installs
-> thêm: SUPPORTED_LIB_VERS="9.0 10.1 11.1 12.1" # This caters for all Oracle 9.x, 10.x and 11.1 installs
tìm line: case $PDO_OCI_VERSION in
9.0|10.1|10.2|11.1|11.2)
-> thêm: case $PDO_OCI_VERSION in
9.0|10.1|10.2|11.1|11.2|12.1)
Bước 5: Cài đặt
/usr/local/php5/bin/phpize
./configure --with-pdo-oci=instantclient,/usr/local/src/instantclient_12_1,12.1 --with-php-config=/usr/local/php5/bin/php-config
make && make install
Bước 6: Enable module, thêm vào php.ini
; Enable pdo_oci (oracle) extension module
extension=pdo_oci.so
REFERENCE:
ORACLE: http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html
OCI8: http://www.php.net/manual/en/oci8.installation.php
PDO_OCI config.mp4 patch: http://svn.php.net/viewvc?view=revision&revision=294487
PDO_OCI manual: http://php.net/manual/en/ref.pdo-oci.php
PDO_OCI v1.0 download: http://pecl.php.net/package/PDO_OCI