Suppose you want to access a data source that lies on microsoft sql server dbms — most probably installed on a windows server machine, although mssql server is now a well fit also on linux machines (see: Ubuntu: Install SQL Server on Linux – SQL Server | Microsoft Docs, btw, this guide is tested a couple of times on ubuntu 20.04, and is actually consisted of 3-4 simple commands you should run and you get a sql server running on a nice cheap linux machine).
Let’s focus on installing the mssql php driver. First of all you should install build essentials, otherwise you won’t be able to build programs with gcc. You should also install odbc development. These are two important prerequisites not necessarily preinstalled on typical bare vps hetzner vps. So, first step is:
sudo apt-get install build-essential
sudo apt-get install unixodbc-dev
Then, install odbc:
Install the Microsoft ODBC driver for SQL Server (Linux) – SQL Server | Microsoft Docs
After that, follow the guide on:
Linux and macOS Installation for the Drivers for PHP – SQL Server | Microsoft Docs
This guide is also test on others versions of php (7.4) not necessarily php8.
I hope this is useful.
Leave a Reply