I
I
Ivan Vekov2018-03-16 13:35:44
PHP
Ivan Vekov, 2018-03-16 13:35:44

How to connect to a remote MSSQL database via php?

1) There is a site on Centos, more precisely on BitrixVM, using mysql.
2) There is a certain server on which there is MSSQL.
3) Send data to MSSQL server via PHP.
4) For access to MSSQL they gave:
- IP
- Database name
- Login
- Password
5) After digging on the Internet, I came to the conclusion that I should probably use odbc_connect. Installed "yum install php-odbc php-mssql"
I still don't understand how to use odbc in this case. I do it like this:

$host = '111.111.111.11';
$database = 'DATABASE';
$user = 'USER';
$password = 'PASSWORD';

$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$host;Database=$database;", $user, $password);

$connection is empty.
PS Selinux-disabled

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman PHP, 2018-03-16
@vekov

so let's move on ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question