F
F
Fyodor2015-03-19 13:14:06
PHP
Fyodor, 2015-03-19 13:14:06

How to work with remote MSSQL database from CentOS in PHP?

The bottom line is - there is a windows server with an mssql server and there is a CentOs server.
I want something - to throw a tunnel between them via ssh and access the mssql server from the CentOS server to php.
This is necessary in order to do some operations (take data from the mysql database and look for them in the mssql database).
Will this happen at all? on a windows server, I raised apache, installed drivers for work, and it worked through sqlsrv_connect.
Port 1433 to use?

ssh -N -p 22 **@test.ru -L 1433:localhost:1433

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

$myServer = "localhost:1433";
$myUser = "usr";
$myPass = "pass";
$myDB = "base";

$link = mssql_connect($myServer, $myUser, $myPass);
if ( !$link ) {
    if ( function_exists('error_get_last') ) {
        var_dump(error_get_last());
    }
    die('connection failed');
}
  ?>

it doesn't connect like that

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kubintsev, 2015-03-19
@Richard_Ferlow

Forget about mssql_* functions altogether, they are no longer supported in the latest versions of php. PDO only.
And where is the SSH server on Windows from?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question