I understand that this question might be a more “general” one and might seem to have little to do with Hestia. The reason posting it here, is by concern that Hestia’s multi-php setup might need special care/treatment when installing packages, to avoid breaking things.
One of my Hestia servers (Ubuntu 18.04) needs to access an MSSQL Database from within PHP. Does anyone have any experience with that?
What I have found out so far…
I need to install some PHP extensions (SQLSRV, PDO_DBLIB) on one of the PHP versions (since I’m using MultiPHP with PHP-FPM). Specifically on the version that is going to be used for connecting to MSSQL.
In the PHP-FPM section of Microsoft docs (because of MultiPHP / PHP-FPM), I read that I need to install the PHP drivers for Microsoft SQL Server using
pecl and then enable the two modules.
What problems I have faced…
pecl install sqlsrv has produced lots of errors like
Warning: Invalid argument supplied for foreach() in Command.php on line 249 PHP Warning: Invalid argument supplied for foreach() in /usr/share/php/PEAR/Command.php on line 249 XML Extension not found
To solve this, I did
apt install php-xml.
Now after running
pecl install sqlsrv I get
downloading sqlsrv-5.8.1.tgz ... Starting to download sqlsrv-5.8.1.tgz (186,879 bytes) ........................................done: 186,879 bytes 34 source files, building running: phpize sh: 1: phpize: not found ERROR: `phpize' failed
I read on Ask Ubuntu, that I need to have
php-dev which installs phpize. But I noticed that by doing
apt install php-dev a whole lot of packages will get installed. Am I on the right track here?
Server’s command line PHP = 7.4
PHP of the web site that will be connecting to MSSQL = 7.3