PHP 7.0 ODBC-Driver for Windows

后端 未结 8 1255
暗喜
暗喜 2021-01-13 07:39

I upgraded my PHP 5.6.30 (https://www.apachefriends.org/de/download.html) to PHP 7.0 (https://bitnami.com/stack/wamp/installer)

Everything worked fine so far and it

相关标签:
8条回答
  • 2021-01-13 08:13

    As an addition to Adrian B`s which mentions the official driver, you can also check https://github.com/thomsonreuters/msphpsql This is an unofficial port. However there are limitations for the time being.

    1. Supports only sqlsrv ODBC but not PDO
    2. Doesn`t support ZTS, only NTS
    3. Supports only x86
    4. It supports a subset of ODBC functions , you can see the list on the page.
    0 讨论(0)
  • 2021-01-13 08:19

    I guess you was right, you need download the SQL Server ODBC driver for your PHP client platform and OS.
    Here is the link for the similar issue: Call to undefined function odbc_connect()

    also you can try to install this connector for MySQL (if you use MySQL): Connector/ODBC

    or if you use MSSQL: ODBC Driver 11 for SQL Server

    0 讨论(0)
  • 2021-01-13 08:23

    PHP7 has a few modules disabled by default that were previously enabled in PHP5.

    It's an easy fix though since the extension should already exist in the \ext\ folder that came with PHP7. You just need to modify your php.ini file to include the line:

    extension=php_odbc.dll
    

    The line above is not already present and commented out; you actually need to add it!

    PHP looks for the php.ini file in C:\Windows\ but it may also be located elsewhere on your machine. So check both C:\Windows\ and C:\php\ or where ever else you may have installed PHP.

    After making the change you can check the results from the command line like this:

    C:\php\php.exe -m
    

    or (after restarting the web server / machine) from a .phtml file like this:

    <? phpinfo(); ?>
    

    That will output a list of enabled modules which should now include odbc; if not, then you may have modified the wrong php.ini file (keep looking) or forgot to restart the web server / machine.


    Tips:

    If you have a non-standard installation, you can use an absolute path like this:

    extension=C:\php7x64\ext\php_odbc.dll
    
    0 讨论(0)
  • 2021-01-13 08:24

    I know this question is rather old. But I've come across the same issue recently ...

    @Naio is right : there are indeed different versions of ODBC drivers, based on the architecture (32bits or 64bits). The driver that PHP uses depends on its own version.

    In other words, if you are using a 32bits ODBC environement, make sure to use a 32bits version of PHP ...

    My guess is that, by switching from PHP 5.6 to PHP 7.0 you also switched from a 32bits version to a 64bits version.

    0 讨论(0)
  • 2021-01-13 08:29

    We need x86 driver from Microsoft. http://www.microsoft.com/ja-jp/download/details.aspx?id=13255 *Sorry, 'ja-jp' is mine. Please select your country. There are 2 drivers, one is 32bit, but we need 64bit(x86) version. Then we could set "ODBC data source (64bit)". It appears on the window. Last, check your web. Maybe it works. Mar. 29th. 2016 Naio

    0 讨论(0)
  • Open your php.ini file and uncomment or add the following lines:

    extension_dir = "C:\PHP\ext"  ;<- your PHP path
    extension=php_pdo_odbc.dll
    extension=php_odbc.dll
    

    Reset Internet Information Services: On command prompt with admin rights type:

    iisreset
    

    This fixed the problem for me.

    0 讨论(0)
提交回复
热议问题