Azure PHP Application and Azure SQL Database
I have a PHP application on Azure and I want this application to connect to Azure SQL Database.
$servername = "AZURE.database.windows.net"; $username = "user"; $password = "pass"; $dbname = "DB"; $conn= mssql_connect($servername,$username,$password, $dbname); $sql = "INSERT INTO AOL (AgentId,FullName, Email) VALUES ('1', 'Doe', '[email protected]')"; mssql_query($sql, $conn); mssql_close($conn);
When I run this php script I get a 500 error.
Do you have experience with PHP on Azure and Azure SQL Database? Or must setting something on Azure for Azure SQL Database?
By default, Azure environment doesn't install php_mssql.dll extension, it installs php_sqlsrv.dll instead.
You can use sqlsrv() instead: