ubuntu连接远程oracle数据库,ubuntu 14.04安装oci8连接oracle数据库

Requirements

Make sure met the following requirements:

Free account on Oracle website to download Oracle Instant Client and SDK files,

Full sudo access to your server,

PHP 5.6 and web server installed (tested with nginx and PHP-FPM).

Install Oracle Instant Client and SDK

Step 1

Download the Oracle Instant Client and SDK from Oracle website. Make sure you choose the correct architecture for your Ubuntu installation (32bit is x86, 64bit is x86_64). You’ll need to upload the files to your server using whatever method suits you.

Step 2

Create a new folder to store Oracle Instant Client zip files on your server.mkdir /opt/oracle

Upload the Instant Clients files inside this folder.

Step 3

Now we need to extract the files.cd /opt/oracle

unzip instantclient-basic-linux-12.1.0.2.0.zip

unzip instantclient-sdk-linux-12.1.0.2.0.zip

Step 4

Next, we need to create a symlink to Instant Client files.ln -s /opt/oracle/instantclient_12_1/libclntsh.so.12.1 /opt/oracle/instantclient_12_1/libclntsh.so

ln -s /opt/oracle/instantclient_12_1/libocci.so.12.1 /opt/oracle/instantclient_12_1/libocci.so

Step 5

Add the folder to our ldconfig.echo /opt/oracle/instantclient_12_1 > /etc/ld.so.conf.d/oracle-instantclient

Step 6

Update the Dynamic Linker Run-Time Bindingsldconfig

Done. Now we can proceed to the next part.

Install Additional Packages

To install the OCI8 extension, we need to install some additional package on our server.

Step 1

Run these command:apt-get install php-pear php5-dev build-essential libaio1

Step 2

Once installed, we need to get the OCI8 file.pecl install oci8-2.0.10

When you are prompted for the Instant Client location, enter the following:instantclient,/opt/oracle/instantclient_12_1

Step 3

We need to tell PHP to load the OCI8 extension.echo "extension = oci8.so" >> /etc/php5/apache2/php.ini

echo "extension = oci8.so" >> /etc/php5/cli/php.ini

Step 4

Restart your apache/etc/init.d/apache2 restart

Now you can connect to Oracle DBMS from your PHP applications.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值