PHP 连接 oracle 报错:Oracle libraries and NLS data 解决方案
PHP(Thinkphp5)使用PDO_OCI连接Oracle 报错:SQLSTATE: OCIEnvNlsCreate: Check the character set is valid and that PHP has access to Oracle libraries and NLS data
解决方法:
php-fpm.conf 底部加上
env = /usr/lib/oracle/19.6/client64/lib
env = /usr/lib/oracle/19.6/client64/lib
指向oracle安装目录
重启php 搞定
附录:
pdo_oci安装流程
centos 7下
1.先安装oracle客户端 oracle客户端rpm包,https://www.oracle.com/database/ ... 6-64-downloads.html 下载
rpm -ivh oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.6-devel-19.6.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.6-sqlplus-19.6.0.0.0-1.x86_64.rpm
软连接
ln -s /usr/include/oracle/19.6 /usr/include/oracle/10.2.0.1
ln -s /usr/lib/oracle/19.6 /usr/lib/oracle/10.2.0.1
2.pdo_oci php源码包编译
cd ext/pdo_oci
/www/server/php/56/bin/phpize
./configure --with-php-config=/www/server/php/56/bin/php-config --with-pdo-oci=instantclient,/usr,10.2.0.1
make && make install
3.oci8 php源码包编译
cd ext/oci8
/www/server/php/56/bin/phpize
./configure --with-php-config=/www/server/php/56/bin/php-config --with-oci8=shared,instantclient,/usr/lib/oracle/19.6/client64/lib
make && make install
php.ini添加
extension=oci8.so
extension=pdo_oci.so
重启php 看看phpinfo
**** Hidden Message *****
页:
[1]