Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to undefined function odbc_connect() php 7

Tags:

php

I'm testing out php 7 and have come across this error:

Fatal error: Uncaught Error: Call to undefined function odbc_connect()

From the doc page: http://php.net/manual/en/function.odbc-connect.php php 7 is not listed as supported.

Does anyone have a way around this or know when it will be supported?

Thanks@

like image 965
bones Avatar asked Dec 16 '15 20:12

bones


4 Answers

The DOC page does list PHP 7, so just install php-odbc and you should be good to go. Currently using it myself on RedHat EL7 with Remi php7.

like image 121
Naidim Avatar answered Nov 02 '22 17:11

Naidim


There is written in doc: ODBC support doesn't need any extension dll. It is true in PHP 5.x, I had to remove "extension=php_odbc.dll" from ini file.
But in PHP 7 I had to put it back.

I found the file "ext/php_odbc.dll" in the new PHP 7 directory again. It works for me :).

like image 32
Hink Avatar answered Nov 02 '22 18:11

Hink


I ran into the same problem. However according to the link you provided PHP7 is in fact supported. So I'm not sure why you have so many comments telling you to go re-write your code.

This is what ultimately fixed the issue for me:

sudo apt-get install php-odbc

Followed by restarting Apache.

like image 6
irwinr Avatar answered Nov 02 '22 17:11

irwinr


PHP 7.2.7, add extension=php_odbc.dll in php.ini file while either using database as MS Access or Sql Server C:\xxxxxx\php\php.ini

*no semicolon before to extension=php_odbc.dll

like image 4
Kanna Reddy Avatar answered Nov 02 '22 17:11

Kanna Reddy