I have been using azure mobile services for my android application. Then I want to access my database datas with my Localhost and Remote server using Php.
I tried the codes that is given by Azure docs below.
$conn = new PDO ( "sqlsrv:server = tcp:MYSERVERNAME.database.windows.net,1433; Database = MY_DATABASE_NAME", "MY_USER_NAME", "MY_PASSWORD" );
try {
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
} catch ( PDOException $e ) {
print( "Error connecting to SQL Server." );
die( print_r( $e ) );
};
When The code is runned on Localhost or Remote server, that is Linux server, I get error below
EDIT
I thought it is about Azure firewall rules and I added my IP number in Azure Firewall rules for Server
When I tried to connect to Server via SQLPro I could connect successfuly and I started to query. But I can not to connect via Localhost with my Php codes.