X
X
XpeH Petrovich2014-09-30 15:05:48
PHP
XpeH Petrovich, 2014-09-30 15:05:48

How to connect to MSSQL from Ubuntu Server+PHP+PDO?

There is a server, not a virtual machine, I use PDO, either - php_dblib, the computer is in the domain, samba seems to see everyone, but I can’t register the connection in PDO (((Tell me how everything should look in the connection? Now something like this:

try {
    $local=new PDO("dblib:host=some_host;dbname=some_dbname, "user", "passwd", $options);
}
catch (PDOException $e) {
    print $e->getMessage();
}

I probably sowed some initial slashes there, or I don’t understand what exactly is missing. Now there are no slashes in the host. If you smoke mana, everything seems to be OK (although it’s about localhost, I don’t have SQL SERVER locally, but it’s on another computer in the domain), but it tells me:
SQLSTATE[HY000] Unknown host machine name (severity 2)

tell me pliz

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
svd71, 2014-09-30
@uakoB

First you need to make sure that you have access to the sequel server. To do this, any mysql client, or at worst with telnet, connect to the server, open the database and simply read the list of tables. If it doesn't work, then figure out why. Most likely some kind of firewall or firewall is running and not allowing you to connect from the outside. Or the muscle has a rule written to work only on localhost

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question