SQL server trouble

SQL server trouble

by Norman Caissie -
Number of replies: 15

I'm going through the Setup wizard after installing moodle.

I get this error:

Error: database driver problem detected

The site administrator should verify server configuration

sqlsrvextensionisnotpresentinphp

I have followed this guid that someone recomended.

 http://www.bfcnetworks.com/whitepapers/

Has anyone seen this before and know how to fix it? It is after I enter the MS SQL server info then click next.

Average of ratings: -
In reply to Norman Caissie

Re: SQL server trouble

by Jim Bennett -

I followed those same whitepapers, and had to do minor tweaks to get it to work.  Our installation is connecting to a SQL Server cluster and is working successfully.

Here are some of the things I did:

  1. install the SQL Server native client on your Moodle server if SQL Server isn't on the same server
  2. install and configure FreeDTS - there's info in one of the discussion groups on this site - I can't remember which off hand
  3. make sure SQL Server is accepting connections on port 1433
  4. I changed NTEXT to VARCHAR(max) in the mssql driver php file - not absolutely necessary but a wise idea since NTEXT is deprecated in SQL Server
  5. make sure you are using the correct DLL - on my first try I inadvertantly referenced the wrong one

Hopefully this helps you.  If not I can send you the details of what I did from a configuration document I put together for our organization.

In reply to Jim Bennett

Re: SQL server trouble

by Norman Caissie -


Thanks for the reply.

Because I am working in the Gov I can't install SQL on the moodle server.

They have to be separated. I also can't install any other software without going through a long and expensive certification process.

I'll try the other things though.

Thanks
In reply to Norman Caissie

Re: SQL server trouble

by Jim Bennett -

FreeDTS is basically a driver, so hopefully it wouldn't be too onerous for you to install it.

By the error message you were getting, it sounds like you may not have the SQL Server driver properly referenced in your php.ini file. Make sure you have these lines at the end of your php.ini:

[PHP_SQLSRV]

extension=php_sqlsrv_53_nts_vc9.dll

[PHP_DBLIB]

extension=php_dblib.dll

and make sure the ddl's they reference are in your ..\php\ext directory.

Let me know if I can be of further help.

In reply to Jim Bennett

Re: SQL server trouble

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers

Norman, which version of Moodle are you installing? 1.9.x or 2.0.x?

You don't need both those drivers. For Moodle 2.0 you use the SQL Server Driver for PHP (php_sqlsrv_53_nts_vc9.dll) and for Moodle 1.9 you use FreeTDS (php_dblib.dll). They do the same thing - connect to SQL Server, so only one is required.

Use http://docs.moodle.org/en/Using_the_Microsoft_SQL_Server_Driver_for_PHP to setup the SQL Server Driver for PHP in Moodle 2.0.

The sqlsrvextensionisnotpresentinphp error probably means that the SQL Server Driver for PHP has not been installed correctly on your web server. Run PHPInfo() to determine if it has been installed and if PHP has loaded it correctly. You have to make sure that the SQL Server Driver for PHP is installed and that PHP has loaded it BEFORE you start the Moodle installation.

In my opinion changing the NTEXT columns to VARCHAR(max) as Jim suggested is NOT a good idea - and it's certainly not necessary. Making those kinds of changes to the database is just asking for trouble...

In reply to Luis de Vasconcelos

Re: SQL server trouble

by Norman Caissie -

Thanks

 

I think am using Moodle 1.9.X but I need to make sure.

I am only certified for 1.9.X but the It guy put two copies on the server.

 

One is MoodleWindowsInstaller-latest-19

and One is moodle-2.0.2

 

The 19 one has a start and stop moodle.exe in it but I need to have it run in IIS and with SQL server 2008.

I think I need to start over. I have to documents the steps I take to get it installed and running so that they can do it in the Production environment.

In reply to Norman Caissie

Re: SQL server trouble

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers

Don't use the MoodleWindowsInstaller package for production servers - especially if you want to use MSSQL and IIS! On production servers you should install Moodle the manual way by downloading and using the .zip package.

On production servers:

  1. First you install and configure PHP and make sure it is running by checking PHPInfo(). Add a PHP Accelerator for best performance.
  2. Then you download and extract the Moodle .zip package to the folder where you want Moodle to run from. That must be the folder that your IIS virtual directory or IIS root is pointing to.
  3. Then you create a MoodleData folder - outside your web root!
  4. Then you create a blank Moodle database in MSSQL.
  5. Finally you run the Moodle setup script. When that script is finished Moodle will be ready for use. You can then pretty it up by selecting an approrriate theme.
  6. Start teaching!
In reply to Luis de Vasconcelos

Re: SQL server trouble

by Norman Caissie -

When I select a Database type do I select FreeDTS or the MS SQL?

In reply to Norman Caissie

Re: SQL server trouble

by Norman Caissie -

When I select the Freedts I get this error. How do I recompile PHP? I restarted IIS.

 

Error: database driver problem detected

The site administrator should verify server configuration

PHP has not been properly configured with the MSSQL extension so that it can communicate with SQL*Server. Please check your php.ini file or recompile PHP.

In reply to Jim Bennett

Re: SQL server trouble

by Norman Caissie -

I was pretty sure I put the extension=php_dblib.dll in that file but after checking it's not there.

I did copy the file there though.

In reply to Norman Caissie

Re: SQL server trouble

by Norman Caissie -

 

I found something new.

When I run PHP.exe I get an error "PHP Startup: Unable to load dynamic library 'C:\php\php_dblib.dll' - The specified module could not be found."

 

My PHP is installed under D:\Apps\PHP

Can I not have it there? It is policy to install apps to the D:\Apps folder. 

Thanks for your help.

In reply to Norman Caissie

Re: SQL server trouble

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers

It looks like PHP isn't configured correctly. Open your php.ini file and check what path the extension_dir variable is pointing to. It should point to D:\Apps\PHP\ext.

And then make sure that the php_dblib.dll file is in the D:\Apps\PHP\ext folder and that freetds.conf has the right info about your database and database server.

Restart the web server and the error should be fixed and PHP should load FreeTDS. You can check if it does load by running PHPInfo(). If it shows a "mssql" section then FreeTDS is loaded and ready to connect to MSSQL.

In reply to Luis de Vasconcelos

Re: SQL server trouble

by Norman Caissie -

I can't find the freetds.conf file.

Is that the file that gets generated when you go through the setup wizard when you first get to the site? That is where I am stuck. The wizard asks for the SQL server info and gives me the error when I click next.