如何在ubuntu机器上安装Oracle InstantClient和pdo_oci? [英] How to install oracle instantclient and pdo_oci on ubuntu machine?
问题描述
我需要在ubuntu机器上安装PDO_OCI,没有可以使用apt-get安装的默认软件包.
I need to install PDO_OCI in ubuntu machine, there is no default package that I could install with apt-get.
有很多教程展示了如何做到这一点,但是当我遵循它们时,我遇到了与编译相关的问题(配置,制作等)
There are a lot of tutorials showing how to do it, but when I follow them, I have problems related to compilation (configure, make,...)
这是我所做的:
-
我遵循了本教程来安装即时客户端
安装oci8
pecl install oci8
我收到错误消息:
错误:找不到oci.h
error: oci.h not found
安装PDO_OCI
Install PDO_OCI
mkdir -p /tmp/pear/download/
cd /tmp/pear/download/
pecl download pdo_oci
phpize
./configure –with-pdo-oci=instantclient,/usr,11.2
错误:
找不到pdo_driver.h ...
pdo_driver.h not found ...
请问您有什么严肃的教程可以在UBUNTU 12.04上完美地工作吗?
Please do you have any serious tutorial that works perfectly on UBUNTU 12.04?
推荐答案
pecl install
中的PDO,PDO_OCI扩展已过时,因为最新的PHP版本已将其内置在其核心&中.通过这种方式安装这些扩展程序大多会失败.
The PDO, PDO_OCI extensions from pecl install
are obsolete because latest PHP version has them built-in its core & installation these extensions by this way mostly failed.
我花了很多时间尝试以下几种方法来做到这一点,但是最终我自己找到了一种干净的方法:从PHP源代码安装扩展.
I've spent a lot of time to try to do this following several approach with no luck, and finally find it out by myself a clean way to do this: compile & install the extensions from PHP source.
During the compilation, there are some tricks as well, I've described the process in detail in my post: https://medium.com/@thucnc/how-to-install-php5-pdo-oci-oci8-and-other-extensions-for-ubuntu-f405eadfe784
此处列出了简短步骤:
- 下载和安装Oracle Instant Client,然后导出
ORACLE_HOME
环境变量 -
下载&从PHP源代码包编译PDO_OCI(如果需要,还可以编译为OCI8),这里需要应用一些技巧,包括:
- Download & install Oracle instant Client, then export
ORACLE_HOME
environment variable Download & compile PDO_OCI (and OCI8 if needed) form PHP source packages, there are some tricks that you need to applied here, including:
sudo ln -s /usr/include/php5/ /usr/include/php
并编辑Makefile:
and edit the Makefile:
EXTRA_INCLUDES = -I/usr/include/oracle/11.2/client64
启用扩展并重新启动Web服务器
Enable the extensions and restart web server
这也已经针对Debian 7.6进行了测试
This has been tested for Debian 7.6 as well
希望这会有所帮助.
这篇关于如何在ubuntu机器上安装Oracle InstantClient和pdo_oci?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!