如何将OCI8安装到现有的PHP中?

6
根据这里(自动安装OCI8),我只需输入pecl oci8 install即可。但是,我反复遇到以下错误。 No releases available for package pecl.php.net/oci8。另一个网站建议我尝试pear install pecl/oci8。同样的错误发生了。我该怎么办才能解决这个问题?

尝试过了吗?http://voidweb.com/2011/04/how-to-install-php-oci8-extension/ - Jenson M John
1
是的,实际上我确实尝试过手动操作,但这很容易出错,并且根据我的经验,如果出了问题,难以撤销。无论如何,如果其他方法都不行,我会再试一次。 - zack_falcon
1个回答

5

我在Ubuntu LTS 14.04上遇到了同样的错误:

~$ sudo pecl install oci8
No releases available for package "pecl.php.net/oci8"
install failed

最后原因是代理问题:我的电脑在公司代理服务器之后。运行以下命令以添加代理

~$ sudo pear config-set http_proxy http://proxy.mycompany.com:8080/
config-set succeeded

然后再次运行该命令,它的工作方式如下所示。
~$ sudo pecl install oci8
downloading oci8-2.0.8.tgz ...
Starting to download oci8-2.0.8.tgz (190,854 bytes)
....done: 190,854 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212

在此,我们将以下内容输入Oracle Instant客户端文件夹:

Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/opt/oracle/instantclient_12_1

然后命令行继续输出:
building in /tmp/pear/temp/pear-build-rootJafknN/oci8-2.0.8
running: /tmp/pear/temp/oci8/configure --with-oci8=instantclient,/opt/oracle/instantclient_12_1
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
...
...
Build process completed successfully
Installing '/usr/lib/php5/20121212/oci8.so'
install ok: channel://pecl.php.net/oci8-2.0.8
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini

祝你好运。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接