MS SQL Server Problem (IIS +Moodle)

MS SQL Server Problem (IIS +Moodle)

by Joseph Craig -
Number of replies: 7
I'm trying to install Moodle with MS SQL Server, following the instructions at


My system is Windows Server 2012 R2, IIS 8.5, SQL Server 2016, PHP 7.4.1, Moodle 3.8.1

I created a database named moodle, and I am able to connect to it using SSMS using the appropriate username and password.

In the Moodle install.php I get this error:

          Error: database driver problem detected
          The site administrator should verify server configuration
          Microsoft Drivers for SQL Server for PHP are not installed or not configured properly.

How do I debug this?

Thanks!

------------
How do I debug this?
Average of ratings: -
In reply to Joseph Craig

Re: MS SQL Server Problem (IIS +Moodle)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

You need the Microsoft Drivers for PHP for SQL Server to access SQL Server from PHP

Microsoft's driver doesn't have a production release for PHP 7.4 yet but there is a preview release.

Also Moodle 3.8 doesn't support PHP 7.4 yet (more info). You may not encounter problems but you should be aware of this.

If you wanted to go ahead with this then the steps should be:

  1. Download the zip file containing the driver (this is probably the NTS x64 version if you have IIS).
  2. Extract php_sqlsrv.dll to the PHP extensions directory, normally the ext subdirectory in the PHP directory.
  3. Add extension=sqlsrv to the php.ini file.
  4. You may need to restart the IIS service to detect the change.

The Microsoft Drivers for PHP for SQL Server have dependencies (Visual Studio run-time and ODBC I think) so you may need to download these if not already present, see System Requirements on the production driver download page for details.

Here's a command line test to see if the driver is installed to be run from the PHP directory:

cd ...\location\of\php.exe
.\php -r "echo 'sqlsrv_connect() ' . (function_exists('sqlsrv_connect') ? 'present' : 'not present') . PHP_EOL;"

This should display "sqlsrv_connect() present" if the driver is loaded correctly (and "not present" if it's not).

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: MS SQL Server Problem (IIS +Moodle)

by Joseph Craig -
Thank you again!

Is PHP 7.1.0 the version I should be using?
In reply to Joseph Craig

Re: MS SQL Server Problem (IIS +Moodle)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I'd use the latest that the Moodle version supports, PHP 7.3 in this case (i.e. 7.3.14 at the time of writing).

In reply to Leon Stringer

Re: MS SQL Server Problem (IIS +Moodle)

by Joseph Craig -
Thanks!



On Wed, Jan 22, 2020 at 12:05 PM Leon Stringer (via Moodle.org) <
In reply to Joseph Craig

Re: MS SQL Server Problem (IIS +Moodle)

by Joseph Craig -
Thanks, again!



I think that I'm all set ... at least until the next bump in the road ...



On Wed, Jan 22, 2020 at 12:47 PM Joseph Craig (via Moodle.org) <