Wow, That’s a few hours of my life I won’t get back but, hopefully, you will after reading this article.

Due to some hideous compatibility issues and the obvious security issues associated with PHP5.6 I took the plunge and updated our server to Ubutntu 14 to Ubuntu 16 and installed PHP7.3.

So good so far.  The phpinfo() worked just fine but I had issues with connecting my Codeingiter App to the onsite MSSQL database.  When I say issues it just said mssql_connect not found.  Luckily I’d heard about this so I didn’t panic and got googling for a quick fix.

Well after a number of hours of chasing the wrong path I came across a VERY SIMPLE solution and here it all is laid out ready to roll!

Step 1: Follow ALL the instructions on this page.  Make sure you install the ODBC driver etc

Step 2.  Modify your Codeigniter database.php to reflect the following:

$db[‘mssql’][‘hostname’] = ‘sqlsrv:Server=SERVERNAME;Database=DBNAME’;
$db[‘mssql’][‘username’] = ‘USERNAME’;
$db[‘mssql’][‘password’] = ‘PASSWORD’;
$db[‘mssql’][‘database’] = ‘DBNAME’;
$db[‘mssql’][‘dbdriver’] = ‘pdo’;
$db[‘mssql’][‘dbprefix’] = ”;
$db[‘mssql’][‘pconnect’] = FALSE;
$db[‘mssql’][‘db_debug’] = TRUE;
$db[‘mssql’][‘cache_on’] = FALSE;
$db[‘mssql’][‘cachedir’] = ”;
$db[‘mssql’][‘char_set’] = ”;
$db[‘mssql’][‘dbcollat’] = ”;
$db[‘mssql’][‘swap_pre’] = ”;
$db[‘mssql’][‘autoinit’] = TRUE;

That SHOULD then work!  If not leave a message in the comments and lets see what we can find together.

PS I did have PHP 7.0 running according to PHPINFO but I quickly changed that to PHP7.3, use a phpinfo file to check your config!