Moodle will not connect to DB

Moodle will not connect to DB

by Chad Gerber -
Number of replies: 13

I am running W2K3, IIS, FastCgi, PHP5 & MSSQL 2000

I have thrashing about for the better part of a day trying to get the install of Moodle completed but it alwys stops with the error:

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.

I have made so many mods to the PHP.ini file I don't know which way is up. Any insight would be great. I have attache dhte PHP.ini File below.

(Edited by Helen Foster to copy and paste text into attached txt file - original submission Wednesday, 21 November 2007, 12:22 AM)
Average of ratings: -
In reply to Chad Gerber

Re: Moodle will not connect to DB

by Dennis Flynn -
;extension=php_mssql.dll
get rid of the semi-colon
caveat: I don't use MSSQL, so not sure if this is all that's needed for things to work right.
In reply to Dennis Flynn

Re: Moodle will not connect to DB

by Richard Enison -

DF,

I don't think it is. See below.

CG,

See http://docs.moodle.org/en/Installing_MSSQL_for_PHP.

Btw, you didn't attach your php.ini file, you pasted it into the post itself. I'm surprised Helen Foster let you get away with it (it's so long)! See http://docs.moodle.org/en/Forum_posting.

RLE

In reply to Richard Enison

Re: Moodle will not connect to DB

by Chad Gerber -

Thank you for the reply.  Unfortunatley I have already been through the Install procedure twice and the reson the msql staement was commented out was because I installed FreeTDS.

In reply to Chad Gerber

Re: Moodle will not connect to DB

by Andrea Davis -

I am having a similar problem, I am using Moodle 18, IIS, MSSQL, PHP 5

Many thanks

In reply to Andrea Davis

Re: Moodle will not connect to DB

by Andrea Davis -

I have tried several things nothing work so my current config/Php.ini are attached.

I am using Moodle 18, MySql 5 and Php 5 running on a MS Server 2003 with IIS. with my current config I get a blank page - I have checked for blank spaces and there seems to be none. I have deleted the file from the moodle area and just run the install and I still get the above error and can not get past the database screen. I have set up my database & user within mysql with a password and thats the same one I use on the database GUI for Moodle.

One confused person...

In reply to Andrea Davis

Re: Moodle will not connect to DB

by Andrea Davis -
it seems I can only add one file so here is theother one
In reply to Andrea Davis

Re: Moodle will not connect to DB

by Matt Molloy -

Hi Andrea,

Both the files you attached are showing blank returns after their last characters. Try opening them in a simple text editor, delete everything after the last character, even blank returns, save the changes and see how that goes.

If you have no joy, repost with an exact description of what is happening. The original title of this post may be throwing people off the scent of the problem.

Matt

In reply to Matt Molloy

Re: Moodle will not connect to DB

by Andrea Davis -

the irony is that I now can not connect to DB.

The story so far:

I tried to delete the blank returns etc from my config.php file using notepad, I just kept getting t_string errors and I could not see the issue even when I downloaded a new version and amended that one also using notepad. So I gave up on that and deleted it from the root to allow the config.php to be created by the installation.

But yet I can not get passed by the problme above now.

  • I have altered the Php/My.ini using notepad according to the installations doc pages.
  • recreated the database/user using mysql command prompt

I am just going round in circles here and I just do not know what I need to do now.

for reference: moodle & moodledata are on the D drive whilst the other programs are under program files on the C drive. I have made this clear in my configure files

Many thanks

In reply to Andrea Davis

Re: Moodle will not connect to DB

by Matt Molloy -

Hi Andrea,

Your config file is showing your server files location as 'd:\moodle' (there is a missing ' here in front of the d:\

This can't be right, as these files must live in the web root. With IIS, this should be something like 'c:\inetpub\www\moodle'

There is no file answering from your web address, http://wisvle/moodle which is expected, because you have your moodle folder elsewhere, but the web address seems incomplete.

These are some things to check. Keep at it, you'll get there!

Matt

In reply to Matt Molloy

Re: Moodle will not connect to DB

by Matt Molloy -

Hi Andrea,

Your web address for Moodle: http://wisvle/moodle will work once you put the moodle folder into the web root. Because you are using iis, your web root is something like c:\inetpub\www\

You need to put the moodle folder here, and record this in the config file. That way, when you type in the web address, the index.php file in the Moodle folder will answer your browser when you type in http://wisvle/moodle.

According to the config file you attached, you are showing the moodle folder in some other drive (I think it said 'd'). Just move the entire moodle folder into your web root and it should work. Here is my best guess of what your config file should look like:

$CFG->dbtype = 'mysql';

$CFG->dbhost = 'localhost';

$CFG->dbname = 'moodle';

$CFG->dbuser = 'root'; //if you accepted the default

$CFG->dbpass = 'whatever_password_you_chose'; // your database password

$CFG->prefix = 'mdl_';

$CFG->dirroot = 'c:\inetpub\www\moodle'; // This is my best guess.

$CFG->dataroot = 'C:\moodledata'; //you need to create this folder on your c drive and give iis readn and right priveleges to it.

The 'moodle' folder must go into the web root folder, and moodledata can stay on the d drive if you wish, just change the relevant entry in the config file ($CFG->dataroot = 'C:\moodledata', change this to D:\moodledata etc...)

Matt

In reply to Andrea Davis

Re: Moodle will not connect to DB

by Richard Enison -
AD,

To supplement MM's comments:
  1. The config.php portion of your combined attachment is virtually unreadable. The line breaks are in all the wrong places and not where they should be. The attached config.php file in your earlier post looked ok, except for the extra line break at the end.
  2. I didn't see the missing quotation mark in the earlier file; perhaps MM is better able to read the later version than I. If so, that would explain the t_string errors.
  3. You need to give a more specific version number for PHP, because PHP 5.0.x is very buggy and incompatible with Moodle.
  4. I believe IIS allows you to change the location of your web root, so that you could have it on drive D if you wanted. But I'm no expert on IIS.
RLE
In reply to Richard Enison

Re: Moodle will not connect to DB

by Andrea Davis -

Hi Richard,

thanks for that, due to the problems I was having I am now trying one of the complete packages and then hopefully configure that...