linux下安装oracle客户端

'1、下载地址
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html 
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm

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

2、安装

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

3、在/etc/ld.so.conf里添加oracle客户端的lib路径
echo '/usr/lib/oracle/11.2/client64/lib/' > /etc/ld.so.conf

4、添加环境变量
vim etc/profile
export ORACLE_HOME=/usr/lib/oracle/11.2/client64/
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64:$LD_LIBRARY_PATH
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"

source /etc/profile  

5、64位要添加32位的软链接
ln -s /usr/lib/oracle/11.2/client64 /usr/lib/oracle/11.2/client 
ln -s /usr/include/oracle/11.2/client64 /usr/include/oracle/11.2/client

6、PHP模块pdo_oci对oracle11支持不足需添加软链接
ln -s /usr/include/oracle/11.2 /usr/include/oracle/10.2.0.1  

ln -s /usr/lib/oracle/11.2 /usr/lib/oracle/10.2.0.1  

7、php连接oracle

php -r '$con = oci_connect("username","password","(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.10)(PORT=1521))(CONNECT_DATA=(SID=ora11g)))","utf8");var_dump($con);'

你可能感兴趣的:(oracle)