【发布时间】:2020-10-20 05:34:44
【问题描述】:
错误
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in
Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
apache php oracle 安装方法
1. /etc/profile
##################### oracle oci setting
export LD_LIBRARY_PATH=/usr/lib/oracle/19.6/:$LD_LIBRARY_PATH
2。下载 oracle 19.6 即时客户端下载/安装
https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
download instantclient-basic-linux.x64-version.zip
download instantclient-sdk-linux.x64-version.zip
download instantclient-sqlplus-linux.x64-version.zip
unzip *
mv instantclient_19_6/ /usr/lib/oracle/19.6
3. ldconfig 设置
echo '/usr/lib/oracle/19.6' > /etc/ld.so.conf.d/oracle-instantclient.conf
ldconfig
4. vi /etc/tnsnames.ora
ORA_TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip_address)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ip_address)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORA_TEST)
(SERVER = dedicated)
)
)
5. oracle 连接测试 ==> 成功
sqlplus test/test@ORA_TEST
6.网络服务器安装
yum -y install httpd httpd-devel mod_ssl
7. php安装
yum-config-manager --enable remi-php56
yum --enablerepo=remi-php56 -y install php php-devel php-cli php-common php-mbstring php-mcrypt php-xml php-pear php-curl php-pecl-imagick php-oci8 php-soap
8. PHP 警告:PHP 启动:无法加载动态库 'oci8.so'
ln -s /usr/lib/oracle/19.6/libclntsh.so.19.1 /lib64/libclntsh.so.19.1
ln -s /usr/lib/oracle/19.6/libnnz19.so /lib64/libnnz19.so
ln -s /usr/lib/oracle/19.6/libclntshcore.so.19.1 /lib64/libclntshcore.so.19.1
9. phpinfo() oci8 in phpinfo
10.控制台 php 测试 ==> 成功
php -r "oci_connect('test', 'test', 'ORA_TEST');"
11.网站 php 代码 ==> 失败
$oracle = oci_connect('test' , 'test', 'ORA_TEST', "AL32UTF8");
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in
Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
12. php -v, php -ri oci8 php -v, php --ri oci8
【问题讨论】:
-
能否详细说明您的问题