Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rtf's avatar
Level 1

sqlsrv driver not found

Hi guys,

Not quite sure if I am doing it wrong as this is my first experience with laravel but I am facing a strange issue with sqldrv. I followed the installation guide of Microsoft and with their test script I could get access to my mssql 2008 DB.

https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017#installing-the-drivers-on-ubuntu-1604-1710-and-1804

Even when I use

php artisan serve

or make a migration everything works like a charm. But now I am struggling when I try to access my page via the public folder which ends in "could not find driver". I use apache2.4 as webserver and created name based virtual host pointing at this laravel folder. Server is hosted on Ubuntu 18.04 with php 7.2. I had permission issue in my mind but due to the ms test script I cannot believe that.

Please find below my virtual host configuration:

# /etc/apache2/sites-available/dashboarddee.conf
<VirtualHost *:80>
        DocumentRoot    /var/www/html/DashboardDEE/public/
        Servername      www.dashboarddee.de
        ServerAlias     dashboarddee

        <Directory /var/www/html/DashboardDEE/public/>
                Allowoverride All
        </Directory>
</VirtualHost>

Appreciate any help.

Best regards rtf

0 likes
3 replies
Talinon's avatar
Talinon
Best Answer
Level 51

I just recently set up a server with the exact same configuration: Ubuntu 18.04 and php 7.2. I just installed the php-sybase module, which includes support for SQL Server thru the pdo_dblib module.

sudo apt-get install php7.2-sybase

check to make sure the module is installed:

$ php -m | grep pdo_dblib

Output:

pdo_dblib

Set up a connection within app/database.php using the driver sqlsrv

    'my_connection' => [
        'driver'    => 'sqlsrv',
        ...
    ]

Then go ahead and test the connection:

dd(DB::connection('my_connection')->getPdo());

You might need to check your freetds configuration (should be installed by default) at /etc/freetds/freetds.conf

You might need to adjust the tds version configuration to have work properly with whatever SQL Server version you're connecting to. I think 7.3 is the default.

http://www.freetds.org/userguide/choosingtdsprotocol.htm

Talinon's avatar

Glad it helped. Please mark the thread as solved.

Please or to participate in this conversation.