Reputation: 861
I installed nginx, php (php5-cli php5-common php5-mysql php5-fpm php-pear php5-cgi php5-odbc php5-curl)
, odbc on my local PC with Ubuntu. And it worked correct until (I guess) I restarted the system. Now I'm getting
Fatal error: Call to undefined function odbc_connect()
My config:
odbc.ini
[My_DB]
Driver = FreeTDS
Description = My_DB
Trace = No
Server = x.x.x.x
Port = 5000
TDS Version = 5.0
Database = dbname
odbcinst.ini
[FreeTDS]
Description = FreeTDS unixODBC Driver v0.63 with protocol v8.0
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
FileUsage = 1
UsageCount = 2
freetds.conf
[My_DB]
host = x.x.x.x
port = 5000
tds version = 5.0
What I found about ODBC in phpinfo()
:
PDO drivers mysql, odbc
ODBC driver for PDO Wez Furlong
ODBC Stig Bakken, Andreas Karajannis, Frank M. Kromann, Daniel R. Kalowsky
What is wrong? Thanks.
Upvotes: 3
Views: 1033
Reputation: 23830
You do not have the (standalone) ODBC package installed, but rather the PDO drivers for ODBC.
You could use them with PDO like
$connection = new PDO('odbc:MSSQLServer', $username, $password);
But to use the odbc_*
functions, it appears you need to enable at least one package listed on the installation page when compiling PHP.
On Ubuntu, you might want --with-unixODBC
, but what you actually need depends on how you use those functions.
But if you're using PHP from apt-get
, you might wanna try
sudo apt-get install php5-odbc
Upvotes: 1