kamushin
kamushin

Reputation: 139

PDO installed but no dblib

root@YYDream:/etc/apache2# dpkg -l |grep php5
ii  libapache2-mod-php5               5.3.10-1ubuntu3.8                   server-side, HTML-embedded scripting language (Apache 2 module)
ii  php5                              5.3.10-1ubuntu3.8                   server-side, HTML-embedded scripting language (metapackage)
ii  php5-cgi                          5.3.10-1ubuntu3.8                   server-side, HTML-embedded scripting language (CGI binary)
ii  php5-cli                          5.3.10-1ubuntu3.8                   command-line interpreter for the php5 scripting language
ii  php5-common                       5.3.10-1ubuntu3.8                   Common files for packages built from the php5 source
ii  php5-curl                         5.3.10-1ubuntu3.8                   CURL module for php5
ii  php5-dev                          5.3.10-1ubuntu3.8                   Files for PHP5 module development
ii  php5-gd                           5.3.10-1ubuntu3.8                   GD module for php5
ii  php5-mysql                        5.3.10-1ubuntu3.8                   MySQL module for php5
ii  php5-odbc                         5.3.10-1ubuntu3.8                   ODBC module for php5
ii  php5-sqlite                       5.3.10-1ubuntu3.8                   SQLite module for php5
ii  php5-sybase                       5.3.10-1ubuntu3.8                   Sybase / MS SQL Server module for php5

I install these packages on server . And the same pachages on my PC. But after I test it.I got information below.

PDO drivers dblib, mysql, odbc, sqlite # this info in phpinfo() on my pc

PDO drivers mysql #this info in phpinfo() on my server

Well, I think I installed the same package for these two machines. But why I lose dblib on my server? Have I miss some important packages?

Upvotes: 5

Views: 13358

Answers (3)

Hemant Kumar
Hemant Kumar

Reputation: 1125

This works for me on Ubuntu 18.04. https://zoomadmin.com/HowToInstall/UbuntuPackage/php7.2-pdo-dblib

If you have multiple PHP version you can check your current PHP version in terminal with this command:

php --ini

sudo apt-get update -y
sudo apt-get install -y php7.0-pdo-dblib
sudo apt-get install -y php7.2-pdo-dblib
sudo apt-get install -y php7.3-pdo-dblib

Don't forget to restart apache

sudo service apache2 restart

For sqlsrv drivers read this documentation: https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15

If you are using php5.6 then you can try this:

sudo apt-get install php5-sybase php5-odbc freetds-common

Refrence: https://www.php.net/manual/en/ref.pdo-dblib.php

Note: Make sure the cli version of PHP and browser version of PHP is same.

Upvotes: 2

Benny Hill
Benny Hill

Reputation: 6240

This is for Ubuntu 12.04 LTS:

sudo apt-get install php5-odbc php5-sybase tdsodbc

php5-sybase will give you dblib, tdsodbc will give you FreeTDS and php5-odbc will give you ODBC. These will likely require other packages so just accept whatever apt suggests when you run the above command.

Upvotes: 7

Endrju
Endrju

Reputation: 2456

Check if freetds-bin and/or freetds-bin:i386 package is installed.

Upvotes: 1

Related Questions