P
P
peregrinTuk2017-10-10 11:36:16
linux
peregrinTuk, 2017-10-10 11:36:16

How to fix error when connecting to MS SQL?

SW. community, please help. I'm trying to connect to MS SQL c under Linux on php, but it returns an error to me (could not find driver). Tell me what driver it can't find? Or is there a simpler connection without using PDO?
This is my first attempt at interacting php and ms sql, so if it doesn't make it more difficult, tell me in as much detail as possible.

try {

    $DBH = new PDO("mssql:host=$server;dbname=$dbname", '$login', '$pass');

} catch (PDOException $e) {

    echo $e->getMessage();
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
peregrinTuk, 2017-10-13
@peregrinTuk

Thank you all for the answers, as it turned out there was no role / permission to the database.

N
Nikolai Kokoulin, 2017-10-10
@Kokoulin

it can't find pdo_mysql
phpfaq.ru/pdo
sudo apt-get install php5-mysql

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question