ODBC调用未定义的函数App \ Http \ Controllers \ odbc_connect()

时间:2017-03-29 14:34:33

标签: php oracle odbc unixodbc

如何让我的php与ORACLE数据库进行对话?

我已经安装了instantclient_11_2&的unixODBC

   # odbcinst -j
    unixODBC 2.3.1
    DRIVERS............: /etc/odbcinst.ini
    SYSTEM DATA SOURCES: /etc/odbc.ini
    FILE DATA SOURCES..: /etc/ODBCDataSources
    USER DATA SOURCES..: /root/.odbc.ini
    SQLULEN Size.......: 8
    SQLLEN Size........: 8
    SQLSETPOSIROW Size.: 8

ODBC.ini如下

    [VASTUPROD]
    #Driver=/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
    Driver=Oracle11.2
    ServerName=//**.**.**.**/VASTUPROD
    Port=1521
    Database=VASTUPROD

odbcinst.ini如下

[Oracle11.2]
Description=Oracle ODBC Driver
Driver=/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
FileUsage=1
UsageCount=5
Trace=yes
TraceFile=/tmp/oracleDriver.log

[Oracle12.2]
Description=Oracle ODBC Driver
Driver=/usr/lib/oracle/12.2/client64/lib/libsqora.so.12.1
FileUsage=1
UsageCount=1
Trace=yes
TraceFile=/tmp/oracleDriver.log

php.ini

extension=/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1

php警告

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1' - libodbcinst.so.1: cannot open shared object file: No such file or directory in Unknown on line 0

isql -v error

[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

1 个答案:

答案 0 :(得分:0)

在php.ini文件中添加或启用extension=php_odbc.dll,然后重新启动服务器。