加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 21:54:03 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试为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,packa
我正在尝试为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,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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读