Archive for July, 2023

How to Connect Apache2 + PHP on Linux to SQL Server 2022 Express on Windows

📅 July 17, 2023
“Help! I have a web server, but all of my data is on a SQL Server instance in Windows. How can I access the data from PHP in Linux without migrating it to MySQL?”

Not a problem! If you have a web server running Apache2 with PHP, you can indeed access SQL Server data located on a different system.

In fact, this is the usual arrangement where the web server runs in its own environment while the database server runs in another. A modular configuration makes it easier to mix and match systems, and fault tolerance is increased. In this case, the database server is running on a Windows system, not MySQL or MariaDB running under Linux.

It is possible to connect to and access SQL Server data from PHP in Linux, but there is some extra setup required compared to MySQL that runs practically out of the box.

This will show how to setup and access Transact-SQL (T-SQL) data located on a Windows virtual machine from a Linux virtual machine running Apache2 with PHP. Do you think you are up for this? Because it is not as straightforward as we might think.

Read the rest of this entry »

, , , ,

Leave a comment