Get Virtualmin's PHP work with Microsoft SQL Server Database

Operating system: CentOS
OS version: 7

Hello there,

I need to be able to work with the remote Microsoft SQL Server Database which is hosted on Windows Server machine using Virtualmin’s PHP. What is the best practice? Does virtualmin comes already with necessary tools (pdo_sqlsrv, odbc) or should I install them seperately? If I should install them what to install exactly and how to configure them? It would be great if you can provide any docs/tutorials.

Thank you in advance.

There is no such thing as “Virtualmin’s PHP”. PHP comes from your OS repos, or from SCL/EPEL.

You should always install additional PHP packages/libraries from your OS repositories when possible. Sometimes it isn’t possible, in which case you may have to build it locally (this should always be a very last resort, however). To build locally you’ll need to install the php-devel package for your version of PHP in order to get the necessary header files to build against it.

We don’t even attempt to install any Microsoft SQL Server related libraries, so you’re on your own there. I don’t know if CentOS has the necessary PHP modules in their repos (I’m almost certain odbc is, though).

1 Like

Here’s a starting point if you haven’t been there already…

You’re fortunate that PHP transacting with MSSQL has come a long way since last time I tried it. Tutorials won’t be as common as MySQL or Postgres but they’re out there.

@Joe well said! @emrecanful well as you said you’re so fortunate docs are there, so follow them :slightly_smiling_face: