PHP PDO和Oracle数据库“找不到驱动程序”

xwbd5t1u  于 2023-06-22  发布在  Oracle
关注(0)|答案(2)|浏览(275)

我已经在PHP和Apache中启用了extension=php_pdo_oci.dll,我也重新启动了wampserver,但仍然没有这个错误Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'
“我不知道你在胡说什么。”
先谢谢你。

h43kikqp

h43kikqp1#

您必须安装PDO Oracle驱动程序适配器:
http://php.net/manual/en/ref.pdo-oci.php

huwehgph

huwehgph2#

您可以在配置文件中设置变量:
在Ubuntu上,在/etc/apache 2/envars中:

export CLIENT_LOCALE=en_US.CP1252
export ORACLE_HOME=/opt/oracle/instantclient_12_1
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_1
export NLS_LANG AMERICAN

或者在vhost配置中:

<VirtualHost *:443>
  ServerName oracleapp.example.org
  SSLEngine on
  SSLCertificateFile  /etc/ssl/certs/wildcard_example.org.pem
  SSLCertificateKeyFile /etc/ssl/certs/wildcard_example.org.key
  SSLCACertificateFile /etc/ssl/certs/wildcard_example.org.chain
  DocumentRoot /var/www/html
  <Directory /var/www/html>
    AllowOverride All
  </Directory>
  SetEnv ORACLE_HOME /opt/oracle/instantclient_12_1
  SetEnv LD_LIBRARY_PATH /opt/oracle/instantclient_12_1
  SetEnv NLS_LANG AMERICAN
  ErrorLog ${APACHE_LOG_DIR}/oracleapp.example.org-ssl-error_log
  CustomLog ${APACHE_LOG_DIR}/oracleapp.example.org-ssl-access_log common
</VirtualHost>

相关问题