标签:des style http color io ar for 文件 sp
环境
主机linux
[devtac@test_1 ~]$ lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 6.4 (Santiago) Release: 6.4 Codename: Santiago [devtac@test_1 ~]$ uname -a Linux test_1.smartpay.com.cn 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
uname -a 看出系统是64位。
php 版本
php-5.5.15.tar.gz
已经源码安装于/usr/local/php
apache 2.X 已经源码安装 并集成了php.
2.需要的软件
oracle 的到此处下载
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
instantclient-sdk-linux.x64-12.1.0.2.0.zip
3.安装oracle三个组件
rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm ln -s /usr/lib/oracle/12.1/client64 /usr/lib/oracle/12.1/client ln -s /usr/include/oracle/12.1/client64 /usr/include/oracle/12.1/client unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip cp -fr /home/devtac/soft/instantclient_12_1/sdk /usr/include/
修改 etc/profile
vi /etc/profile 在文件最后面加入 export ORACLE_HOME=/usr/lib/oracle/12.1/client64 export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64:$LD_LIBRARY_PATH export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
退出 vi,执行,使修改立即生效 source /etc/profile
LD_LIBRARY_PATH,NLS_LANG 目前还没发现在此次安装多大用处。
4 安装pdo 和oci
4.1 安装pdo
cd 到php 解压目录下
php-5.5.15/ext/pdo_oci
/usr/local/php/bin/phpize 会生成configure 文件 ./configure --with-oci8 --with-php-config=/usr/local/php/bin/php-config make #make 时报找不到oci.h文件 我然后把/usr/include/sdk/include 目录下头文件都复制过去了 cp /usr/include/sdk/include/*.h /home/devtac/soft/php-5.5.15/ext/pdo_oci/ make #成功 make install #成功 #make install 成功后 /usr/local/php/lib/php/extensions/no-debug-zts-20121212/目录下生成 -rwxr-xr-x. 1 root root 496655 8月 27 17:46 opcache.so -rwxr-xr-x. 1 root root 128581 9月 24 11:07 pdo_oci.so
配置 pdo
php.ini 里添加
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20121212/pdo_oci.so
重启apache
php -m | grep PDO 检查是否扩展成功,浏览器访问info.php 也可以验证是否扩展成功
[root@test_1 bin]# /usr/local/php/bin/php -m | grep PDO PDO PDO_OCI
4.2 安装oci
与pdo 类似 以下是安装命令,不详述了
cd /home/devtac/soft/php-5.5.15 cd ext cd oci8/ /usr/local/php/bin/phpize ./configure --with-oci8 --with-php-config=/usr/local/php/bin/php-config make make install cd /usr/local/php/lib/php/extensions/no-debug-zts-20121212/
配置 php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20121212/oci8.so
/usr/local/php/bin/php -m | grep oci /usr/local/apache/bin/apachectl restart
5. 写个php 测试下
<?php $db="oci:dbname=//114.114.218.106:1521/xxxxx;"; $dbname="xxxx"; $dbpwd="xxxxx"; $pdo=new PDO($db,$dbname,$dbpwd); $sql="select * from table"; $result=$pdo->query($sql); foreach($result as $row){ echo $row[1]. "\t"; } ?>
标签:des style http color io ar for 文件 sp
原文地址:http://my.oschina.net/u/234018/blog/317853