个人工具
119.28.94.63
该IP地址的讨论
登录
查看“UbuntuHelp:PHPOracle”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:PHPOracle”的源代码
来自Ubuntu中文
←
UbuntuHelp:PHPOracle
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/PHPOracle}} {{Languages|UbuntuHelp:PHPOracle}} To be able to access Oracle databases from PHP, you will need to have PHP compiled / linked with the Oracle OCI (oci8) library. You could use the [http://www.oracle.com/technology/tech/php/zendcore/index.html pre-built PHP 5 from Zend] or there are two other ways to get PHP working with OCI8: <ol><li>Install the Oracle Database [Oracle10g] [Oracle9i] </li><li>Install Oracle Instant Client</li></ol> If your Oracle database is in another machine, the Oracle Instant Client is a smaller install. === PHP using Oracle Database Server === TODO === PHP using Oracle Instant Client === Tested Environment: Ubuntu Server 10.04 LTS Oracle Instant Client 11.2 Prerequisites: <pre><nowiki> sudo apt-get install build-essential sudo apt-get install php5-dev php-pear </nowiki></pre> Instant Client installation requires some environment variables to be able to see the library folder. Edit /etc/environment and add at the end: <pre><nowiki> # Oracle Instant Client LD_LIBRARY_PATH="/usr/local/lib/instantclient_11_2" TNS_ADMIN="/usr/local/lib/instantclient_11_2" ORACLE_BASE="/usr/local/lib/instantclient_11_2" ORACLE_HOME=$ORACLE_BASE </nowiki></pre> Then download the [http://www.oracle.com/technology/tech/oci/instantclient/index.html Oracle Instant Client from Oracle.com] (you will need to create an account) You will need the Basic (48MB) and SDK (600K). The Basic Lite version does not work. <pre><nowiki> cd /usr/local/lib sudo unzip <location-of-instant-client-basic> sudo unzip <location-of-instant-client-sdk> cd instantclient_11_2 sudo ln -s libclntsh.so.11.1 libclntsh.so </nowiki></pre> The symbolic link is needed by during the compilation step later. <pre><nowiki> sudo pecl install oci8 </nowiki></pre> You will be prompted for the location of the library: <pre><nowiki> instantclient,/usr/local/lib/oracle_11_2 </nowiki></pre> You will be prompted also for the ORACLE_HOME location, type 'all', accept and then insert: <pre><nowiki> instantclient,/usr/local/lib/oracle_11_2 </nowiki></pre> If successful, you may now add the following line at the bottom of php.ini <pre><nowiki> extension=oci8.so </nowiki></pre> The php.ini is found in 2 places: /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini <pre><nowiki> sudo /etc/init.d/apache2 reload </nowiki></pre> Check <?php echo phpinfo() ?> to verify if the OCI8 module is available. === Further Reading === * [http://www.orafaq.com/wiki/PHP Oracle PHP Wiki] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:PHPOracle
。