Instalado o sqlsrv usando as etapas a seguir, mas não é possível conectar o sql server express 2017
Passo 1. Instale o PHP
apt-get update
apt-get -y install php7.0 mcrypt php7.0-mcrypt php-mbstring php-pear php7.0-dev php7.0-xml
Etapa 2. Instalar pré-requisitos
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql mssql-tools
sudo apt-get install unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
Etapa 3. Instale os drivers PHP para o Microsoft SQL Server
sudo pear config-set php_ini 'php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"' system
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
db.php
(nenhuma mensagem exibida depois de executar este script)
<?php
$serverName = "servername"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"database", "UID"=>"user", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
você poderia por favor ajudar? ubuntu 16.04.1 depois de executar acima do script db.php ele exibe a página em branco.