+ Post New Thread
Results 1 to 2 of 2
Virtual Learning Platforms Thread, Moodle - Error: Database connection failed. in Technical; Guys, I need help! Yesterday, while preparing my site for upgrading to moodle 2.0, I was looking at my enviroment ...
  1. #1
    JamesBray's Avatar
    Join Date
    Jun 2007
    Location
    Dorset, England
    Posts
    8
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Exclamation Moodle - Error: Database connection failed.

    Guys, I need help!

    Yesterday, while preparing my site for upgrading to moodle 2.0, I was looking at my enviroment variables, and I noticed that CURL wasn't installed. This is only a reccomendation in 1.9, but a requirement in 2.0. Anyway, after un-commenting extension=php_curl.dll in my php.ini, it still didn't work, and while googling around, the advice was that PHP 5.2.14 didn't handle CURL very well and that I should upgrade my PHP to 5.3.3.

    So I removed PHP, which was installed in C:\Program Files\PHP, and following the 5.3.3 installation advice, installed the new version in C:\PHP (because it doesn't contain a space).

    So I did that, and setup my new PHP.ini (attached) and restarted IIS, and went to phpinfo() which as you can see confirms the install has worked, but when I try and look at any of the moodle pages I get the error message:

    Error: Database connection failed.

    It is possible that the database is overloaded or otherwise not running properly.

    The site administrator should also check that the database details have been correctly specified in config.php


    Here is the contents on my config.php, which looks fine to me (password changed obviously):

    ------------------------------------------------------------------

    <?php /// Moodle Configuration File

    unset($CFG);

    $CFG = new stdClass();$CFG->dbtype = 'mysql';
    $CFG->dbhost = 'localhost';
    $CFG->dbname = 'moodle';
    $CFG->dbuser = 'moodleuser';
    $CFG->dbpass = 'SecurePa55w0rd';
    $CFG->dbpersist = false;
    $CFG->prefix = 'mdl_';

    $CFG->wwwroot = 'http://moodle.purbeck.dorset.sch.uk';
    $CFG->dirroot = 'D:\IIS\inetpub\wwwroot';
    $CFG->dataroot = 'D:\moodledata';
    $CFG->admin = 'admin';

    $CFG->directorypermissions = 00777; // try 02777 on a server in Safe Mode

    $CFG->passwordsaltmain = '{5Q]5?]BK.Hk,358~MTs,hXJqHJttN';

    require_once("$CFG->dirroot/lib/setup.php");// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.?>


    -------------------------------------------------------------------

    Any advice? I am desperately pulling my hair out at the moment trying to get this going, but to no avail.

    I am using MySQL, IIS 7, Server 2008 SP2, Moodle 1.9.9+

    Thanks in advance for the help!
    Attached Files Attached Files

  2. #2

    Join Date
    Nov 2009
    Location
    Manchester
    Posts
    1,114
    Thank Post
    6
    Thanked 221 Times in 200 Posts
    Rep Power
    56
    Firstly have you tried connecting to the SQL dataase directly to prove the issue is due to PHP problems?



SHARE:
+ Post New Thread

Similar Threads

  1. [SIMS] SIMS Connection failed for Login USERNAME reason: 0
    By tech_guy in forum MIS Systems
    Replies: 43
    Last Post: 11th November 2014, 03:22 PM
  2. MS SQL 2005 Database connection error
    By mcheung0 in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 22nd June 2010, 11:22 AM
  3. [Fog] FTP connection to Storage Server has failed!
    By Batman in forum O/S Deployment
    Replies: 14
    Last Post: 26th May 2010, 11:11 PM
  4. SIMS Connection failed - Reason 2
    By mortstar in forum MIS Systems
    Replies: 23
    Last Post: 5th June 2008, 01:48 PM
  5. Backup failed unlocking database
    By ctbjs in forum MIS Systems
    Replies: 4
    Last Post: 17th December 2007, 03:58 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •