0
I am with a problem for days with an external connection PDO sqlsrv, I have scanned the internet and I did not find a solution.
I installed all sql server drivers for PHP, including, I installed sql server on my machine to test a local connection and it worked... however, the external connection does not work in PHP. I can connect normally on the external server by SQL Management Studio, putting IP, user and password.
Here is the code and the error:
try
{
$servidor = "aqui vai o ip";
$instancia = "instancia";
$porta = 1433;
$database = "banco";
$usuario = "usuairo";
$senha = "senha";
$conexao = new PDO( "sqlsrv:Server={$servidor}\\{$instancia},{$porta};Database={$database}", $usuario, $senha );
}
catch ( PDOException $e )
{
echo "Drivers disponiveis: " . implode( ",", PDO::getAvailableDrivers() );
echo "<br> Erro: " . $e->getMessage();
}
Error:
Drivers disponiveis: mysql,odbc,sqlite,sqlsrv
Erro: SQLSTATE[28000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Falha de logon do usuário 'usuairo'.
Someone helps??
You created the Language for the database on your server?
– Pbras
@Pbras, yes, user and password, works in Management Studio, but not in PHP
– JASL