环境:
PHP 7.4
框架:laravel6
已安装扩展:oci8-2.2.0,pdo-oci
数据库:oracle12
已配置了环境变量
使用oci_connect连接,命令行执行:
php -r 'var_dump(oci_connect("username", "password", "host:port/database"));'
出现问题1:
ErrorException
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
使用pdo连接,命令行执行:
php -r 'var_dump(new PDO("oci:dbname=host:port/database", "username", "password"));'
出现问题2:
SQLSTATE[HY000]: pdo_oci_handle_factory: Error while trying to retrieve text for error ORA-01804
(/builddir/build/BUILD/php-7.4.32/ext/pdo_oci/oci_driver.c:714)
使用pdo连接,命令行执行: