简体   繁体   English

如何在Ubuntu 16.04中使用oci8将PHP 7与Oracle 12c连接

[英]How to connect php 7 with oracle 12c using oci8 in ubuntu 16.04

I am using php 7 with Oracle 12c in ubuntu16.04.Want to connect php with Oracle database using oci8. 我在ubuntu16.04中将php 7与Oracle 12c一起使用。想使用oci8将php与Oracle数据库连接。 When I type php - m|grep oci8 then it shows it is installed. 当我键入php-m | grep oci8时,表明它已安装。 But when I try to connect it shows "could not find driver". 但是当我尝试连接时,它显示“找不到驱动程序”。 Many solutions are shown in windows but not in Linux. Windows中显示了许多解决方案,而Linux中未显示。 I can connect oracle using a username and password and fire query in oracle query console. 我可以使用用户名和密码连接oracle,并在oracle查询控制台中启动查询。

Make sure the appropriate environment variables for Oracle eg LD_LIBRARY_PATH are set. 确保为Oracle设置了适当的环境变量,例如LD_LIBRARY_PATH。 These need to be set separately for your webserver and your terminal shell. 这些需要分别为您的Web服务器和终端Shell设置。

For the Ubuntu webserver you will probably use the apache2 envvars file (It's /etc/sysconfig/httpd on RHEL systems). 对于Ubuntu Web服务器,您可能会使用apache2 envvars文件(在RHEL系统上为/ etc / sysconfig / httpd)。 There are tips are in the section 'Setting the Oracle Environment for PHP on Linux' on p77 of http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html的 p77上的“在Linux上为Linux上的PHP设置Oracle环境”部分中有技巧

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM