ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

使用pecl安装Php PDO OCI驱动程序

2019-07-27 23:29:51  阅读:752  来源: 互联网

标签:php pdo oci


我正在尝试为OCI安装PDO驱动程序.

在Google上搜索pdo_oci时,我找到以下网址:

https://pecl.php.net/package/PDO_OCI

它在页面顶部显示此消息:

This package is not maintained anymore and has been superseded. Package has moved to channel 07001, package ext/pdo_oci.

这条消息意味着什么,如何使用pecl添加此通道?

我试图使用pear channel-discover php.net/pdo_oci添加该频道,但它似乎不起作用.我也找不到php.net/pdo_oci的channel.xml文件,所以我可以试试pear channel-add channel.xml.

解决方法:

编辑

如果你已经安装了php(例如从存储库),你只能从PHP源代码编译PDO_OCI(你需要安装instantclient)

> Download the PHP source与您拥有相同的版本
安装;
>解压缩;
>切换到目录
PHP-YOUR-VERSION / EXT / PDO_OCI

在pdo_oci文件夹中,运行以下命令:

$phpize  
$./configure --with-pdo-oci=instantclient,/usr,12.1  
$make && make install  
$echo "extension=pdo_oci.so" > /etc/php.d/pdo_oci.ini  
$service httpd restart

这个方法只会在PHP扩展文件夹中创建一个pdo_oci.so,不需要重新编译整个PHP.您可以使用PHP的存储库版本来执行此操作,并且可以使用PHP源中的ext文件夹内的任何扩展来执行此操作.

首先,抱歉我的英语不好.

我有同样的问题,但我已经可以解决了.

如消息所示,此PECL扩展已弃用.您需要使用PHP Source中包含的PDO_OCI从源代码编译PHP.

我在CentOS 6.6中这样做了,安装了MySQL,Apache和InstantClient:

安装依赖项,如

curl-devel
freetype-devel
libc-client
libc-client-devel
libjpeg-devel
libmcrypt-devel
libpng-devel
libtool-ltdl-devel
libxml2-devel
libXpm-devel
libc-client
libc-client-devel
libmcrypt-devel
libpng-devel
db4-devel

...And other prompted dependencies in the ./configure 
(always install the *-devel package too)

下载PHP源代码

$wget http://ar2.php.net/get/php-5.6.10.tar.gz/from/this/mirror  

解压缩下载的文件并更改为文件夹

$tar -xzf php-5.6.10.tar.gz  
$cd php-5.6.10  

使用所需的参数执行configure命令(我的示例如下)

./configure \   
--prefix=/usr \  
--sysconfdir=/etc \  
--localstatedir=/var \  
--datadir=/usr/share/php \  
--mandir=/usr/share/man \  
--with-config-file-path=/etc \  
--with-config-file-scan-dir=/etc/php.d \  
--with-zlib \  
--enable-bcmath \  
--with-bz2 \  
--enable-calendar \  
--with-gdbm \  
--with-gmp \  
--enable-ftp \  
--with-gettext \  
--enable-mbstring \  
--with-readline \  
--with-apxs2 \  
--with-pdo-oci=instantclient,/usr,12.1 \  
--enable-dba=shared \  
--with-pdo-mysql --with-mysql-sock=/var/mysql/mysql.sock \  
--with-pdo-pgsql \ 
--with-mcrypt \  
--with-mhash \  
--with-curl \  
--with-gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-vpx-dir=/usr \
--with-freetype-dir=/usr \
--with-t1lib=/usr \
--with-libxml-dir=/usr \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \  
--enable-soap \
--with-xmlrpc \
--with-xsl \
--with-tidy=/usr \
--enable-pcntl \
--enable-sysvshm \
--enable-sysvmsg \
--enable-shmop

如果在运行此命令时看到任何错误,则可能缺少某些依赖项(可能是我未提及的依赖项).

运行configure命令后没有错误

$make && make install  

此时,已经安装了PHP.
要进行认证,请使用以下命令:

$php -v  

但在结束之前,我们需要做一些调整……

将php.ini复制到正确的目录

### If you're on a development server    
$cp php.ini-development /etc/php.ini

### If you're on a production server
$cp php.ini-production /etc/php.ini

打开Apache配置文件进行编辑

$vi /etc/httpd/conf/httpd.conf

添加以下行,以便Apache解释PHP(如果已经有,则忽略)

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps   

重启Apache

$service httpd restart

标签:php,pdo,oci
来源: https://codeday.me/bug/20190727/1558484.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有