使用Ubuntu Server 17.04 PHP 7和apache2加载oci8.so时出错 [英] Error loading oci8.so with Ubuntu server 17.04 php 7 and apache2
问题描述
我已经完成了在Ubuntu Server 17.04中下载Oracle Instant Client,SDK等的整个过程.然后将rpm软件包转换为带有外星人的deb,进行安装,设置路径,下载pecl oci8,进行编译和安装(无错误)等,然后添加以下行:
I have gone through the whole process of downloading Oracle instant client, SDK, etc. in a Ubuntu Server 17.04. Then converted rpm packages to deb with alien, installed, set the paths, downloaded pecl oci8, compiled and installed (w/o errors), etc. and then added the line:
extension =/usr/lib/php/20151012/oci8.so
extension=/usr/lib/php/20151012/oci8.so
并重新启动.当我检查/var/log/apache2/error.log时,我看到:
And restarted. When I check the /var/log/apache2/error.log I see:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/oci8.so' - libmql1.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Thu Jul 20 10:46:44.352631 2017] [mpm_prefork:notice] [pid 23450] AH00163: Apache/2.4.25 (Ubuntu) configured -- resuming normal operations
[Thu Jul 20 10:46:44.352717 2017] [core:notice] [pid 23450] AH00094: Command line: '/usr/sbin/apache2'
有人知道我能做些什么来使其工作吗? 我想我还没有启用selinux,或者这可能是权限问题?
Does any one know what I could do to make it work? I guess I have not selinux enabled or maybe it is a permissions problem?
谢谢
推荐答案
解决方案是将ORACLE全局变量不放在/etc/environment中,而放在/etc/apache2/envvars中
The solution is to put the ORACLE global variables NOT in /etc/environment but in the /etc/apache2/envvars
因此,我在/etc/apache2/envvars的末尾添加了这两行
So, I've added these 2 lines at the end of /etc/apache2/envvars
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
export ORACLE_HOME=/usr/lib/oracle/12.2/client64
一切都很好
这篇关于使用Ubuntu Server 17.04 PHP 7和apache2加载oci8.so时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!