Connecting to Microsoft SQL Server with PHP

Hi everyone,

I’m trying to connect to an external Microsoft SQL server with PHP. However, my issue is that when attempting to connect to the server with either “mssql_connect” or “sqlsrv_connect,” I get this error message:
Fatal error: Call to undefined function mssql_connect()

After running the line “print_r(PDO::getAvailableDrivers());” in PHP, I have ‘mysql’ and ‘pgsql’ installed, but no mssql or sqlsrv.

How would I go about being able to use sqlsrv functions in my Cloud9 workspace?

Read this: http://php.net/manual/en/function.mysql-connect.php

mysql_connect() This extension was deprecated in PHP 5.5.0

You should be using either mysqli_connect() http://php.net/manual/en/function.mysqli-connect.php
OR
PDO (http://php.net/manual/en/pdo.construct.php)

How to set up MySQL

I’m sorry to say this, but your reply has nothing to do with the question at hand.

The question was for MS SQL, not MySQL.

Oops, sorry I misread the question :slight_smile: I’m sure you found a solution given that this question was 10 - 11 months ago.