This question already has an answer here:
This is the PHP code:
<?php
$datasource = "NAME";
$servername = "SERVER:PORT";
$username = "USER";
$password = "****";
$conn = odbc_connect($datasource, $username, $password, SQL_CUR_USE_ODBC);
if (!($conn)) {
exit("Connection Failed: " . $conn);
} else {
$sql = 'SELECT * FROM DUMMY';
$rs = odbc_exec($conn,$sql);
if (!$rs) {
exit("Error in SQL");
}?>
This is the error:
Fatal error: Uncaught Error: Call to undefined function odbc_connect() in C:\xampp\htdocs\xxx.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xxx.php on line 7
But, as far as I know, my xampp has php_odbc ext installed.
This is my sistem:
- Xampp + Windows 10
- Apache/2.4.38 (Win64) OpenSSL/1.1.1a PHP/7.3.2
On my php.ini:
[PHP]
extension=php_pdo_odbc
extension=php_odbc
[ODBC]
odbc.default_cursortype
odbc.allow_persistent=On
odbc.check_persistent=On
odbc.max_persistent=-1
odbc.max_links=-1
odbc.defaultlrl=4096
odbc.defaultbinmode=1
</div>