Ubuntu nginx on local machine. Fatal error: call to undefined function odbc_connect ()
I have installed nginx, php (php5-cli php5-common php5-mysql php5-fpm php-pear php5-cgi php5-odbc php5-curl)
odbc on my local Ubuntu PC. And it worked correctly until (I think) I restarted the system. Now I get
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 mysql, odbc drivers
ODBC Driver for PDO Wez Furlong
ODBC Stig Bakken, Andreas Karajannis, Frank M. Kroman, Daniel R. Kalowski
What's wrong? Thank.
source to share
You don't have a (standalone) ODBC package, but PDO drivers for ODBC .
You can use them with PDO like
$connection = new PDO('odbc:MSSQLServer', $username, $password);
But to use the functions, odbc_*
you need to include at least one package listed on the page when PHP is compiled.
On Ubuntu, you may need it --with-unixODBC
, but what you really need depends on how you use these features.
But if you are using PHP from apt-get
you can try
sudo apt-get install php5-odbc
source to share