Site is down! I've check these items..What else

Site is down! I've check these items..What else

by Rob Byrd -
Number of replies: 18
I am a new linux server and moodle administrator. studetns emailed saying they couldn't log in even though I was online in moodle at the time. within about 5 minutes my connectin was also not responding. I went to the phyisical server and could log in to mooodle fine. But still not from a workstation. I restarted the server and then do the white moodle screen with the red border saying :

"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"

The databse (mysql 4.1.1) is not overloaded since we have only 15 courses and less than 100 students. The sever is not used for anything except this prototype/pilot CMS. I check the values on the config.php. They looked right. To verify, I logged in manually to mysql using:

'mysql -h myhost -u  the-moodle-use-name -p'

And could log in fine. I also changed to the correct db, showed tables etc. everything seemed okay.

what else can I try? where could the problem be.

THanks for any suggestions.


Average of ratings: -
In reply to Rob Byrd

Re: Site is down! I've check these items..What else

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Try shutting down the MySQL process and restarting it.
In reply to Martin Dougiamas

Re: Site is down! I've check these items..What else

by Rob Byrd -
Thank you. It restarts fine,  so does Apachectl 'restart'.  I can log into the site using ssh (winscp). I can also putty into the site on port 22  I can open a mysql session and change to the moodle db remotely. I ran the "show full processlist;" and there is only one row: me.  I am runing linux Fedora Core 4. There are only about 7 non-moodle users on this entire one computer network and they seldom login. There are about 99 studetns in 15 courses but only 5 courses are really active. Checking my root mail for Activity Log I saw that max connections was at one time was 35, but is usually less than 5.

Even when I am the only user I get the same message.

the site is http://ikm.york.edu/cats
In reply to Rob Byrd

Re: Site is down! I've check these items..What else

by Rob Byrd -
As an update to my site that is still down I have upgraded from mysql 4.1.1 to the latest yum that Fedora has, 4.1.16, and it installed fine I can log into it using commandline. I also checked for updates on the apache server 2.0.x but there no updates to download for yum. Any more ideas?

Thank you.

the hardware is an AMD64 with 2GB RAM and a RAID-1 pair of 250GB HDDs
In reply to Rob Byrd

Re: Site is down! I've check these items..What else

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Are you sure your moodle/config.php didn't change? It sounds like it might have problems.
In reply to Martin Dougiamas

Re: Site is down! I've check these items..What else

by Rob Byrd -

Since my moodle wwwroot is ../cats, my '../moodle/config.php' should be ../cats/config.php' correct? and my CFG settings are in that file. In that directory there are several folders and other files: admin, auth, backup, blocks, calendar \etc, are the folders\ .

Here are the file contents:    /*comments like this are not in the file and <var> means that's not really is what is there but a verified value that still doesn't work using moodle, only linux shell*/

unset($CFG);
$CFG->dbtype    = 'mysql';    /* since I'm using MySQL */
$CFG->dbhost    = 'ikm.york.edu';    /* db host I can connect to using #mysql -h ...  */
$CFG->dbname    = 'moodle';  /* db I can change to using mysql> use moodle;  */
$CFG->dbuser    = 'moodleuser';  /* mysql I can connect to:  #mysql -h <x> -u ...  */
$CFG->dbpass    = <mypass> ; /* my password that is in single quotes that works when I log in from the #mysql -h <x> -u <y> -p  */
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';

$CFG->wwwroot   = 'http://ikm.york.edu/cats';   
$CFG->dirroot   = '/var/www/html/cats';  /* config.php and other files are  here */ $CFG->dataroot  = <my data>;  /*absolute path to moodle data in single quotes */
$CFG->admin     = <admin username>; /* the login name for admin that uses the above password. It's in single quotes */

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

Three last questions:
1. Is there a second config.php somewhere that is overriding this one, or a different was for moodle to conect to the db?
2. Would it be worth it to reinstall everything?...that's where I am feeling about now.
3. How many additional "config" and "setup" files are scattered throughout the operating system that will have to be backed up to keep all the user info and course info in tact?

In reply to Rob Byrd

Re: Site is down! I've check these items..What else

by Rob Byrd -
I upgraded mysql to 4.1.16 and tried to upgrade to moodle 1.5.3+

I made the backups, extracted the moodle files into my <dirroot> dir called "cats", copied the config.php to the cats dir (my config.php was described in the previous post), pointed to http://<wwwroot>cats/admin and got the same error message in red text with white background "Error: Database connection failed...."

So I verified from the linux shell that I could still connect using the parameters in ../cats/config.php: I can still connect from the command line.

I checked to make sure there weren't any invisible characters after the ?> in the config.php file....

I'm still open for suggestions, thanks for the ones you have provided so far.



In reply to Rob Byrd

Re: Site is down! I've check these items..What else

by David Delgado -

It may sound silly, but I think it may be not: why don't you just get a brand new config.php file (the one provided with your current Moodle installation files) and retype all your server data again? Do it in the unix shell, via ssh with vi editor, for example. 

I think it could work, since it reminds me of some kind of problems related to invisible characters and so on. Just try it, it will not take much time, and it is a chance. I cannot think of anything else right now, sorry. I hope this may help you.

In reply to David Delgado

Re: Site is down! I've check these items..What else

by Rob Byrd -
It sounded perfectly logical... It just didn't work.  But I really appreciate the effort.

I am starting to warm up another server, I just dread the thought...

Rob
In reply to Rob Byrd

Re: Site is down! I've checked ...What else

by Rob Byrd -
My main (non-moodle) web page has an index.php that gets interpreted correctly when I put a simple php echo command and output a string. I also tried phpinfo(); and it worked as well.  So I have a php connection (and apache must be working for me to see the main simple webpage remotely)

I also re-entered the moodleuser password for mysql using the SET PASSWORD FOR... in the mysql monitor.

When I ran the phpinfo() method and viewed some of the settings I noticed that in Apache2handler section, the Hostname: Port field was 'ikm.york.edu:0' rather than :80, but I think that is just a formatting issue since in the Apache Environment section the variable SERVER_PORT lists 80. And when I Port Scan my ip address httpd 80 is one of the listeners found.

I can see all the phpinfo vars. Is there one that may be significant in determining what my problem is?

The directory permissions are 755 for both the main web page ../html/ and the moodle page ../html/cats.

Here are my LAMP versions
Linux 2.6.x Fedora Core 4
apache -v    Apache version: 2.0.54
mysql -v      mysql v4.1.16
php -v          PHP v5.0.4 w/ Zend v2.0.4-dev

In reply to Rob Byrd

Re: Site is down! I've checked ...What else

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
OK, let's try something more 'direct'. Edit you .../cats/lib/setup.php file, and search around line 115 (line number may vary slightly between versions) for a text that reads:

$db = &ADONewConnection($CFG->dbtype);

error_reporting(0); // Hide errors

and modify the 'error_reporting()' line to read:

error_reporting(E_ALL);
$db->debug = true;

so that we get (maybe tons!) of errors/warnings/notices on screen and in the webserver logs, and can find the source of the error.

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Site is down! I've checked ...What else

by Rob Byrd -
Thank you there is a glimmer of hope!

I changed the setup.php as you suggested and get only one error message:

ikm.york.edu: Can't connect to MySQL server on 'ikm.york.edu' (13)

This is the correct host and I can still connect remotely when using putty.exe. From the console I type 'mysql -u <moodle user name> -h ikm.york.edu -p' and I'm in the console. I can then change dbs, show tables, etc.

Anything else I can try, or does that give anyone a hint?


In reply to Iñaki Arenaza

Re: Site is down! I've checked ...What else

by Rob Byrd -
I also found a session-test.php file in the ../lib directory and ran it successfully. Here is its output:

Session found - welcome back!

Sessions are working correctly

Reload this page

 
In reply to Rob Byrd

Re: Site is down! I've checked ...What else

by Rob Byrd -
Okay. Now I have comlpetely reinstalled fedora core 4 (new installation) to make sure I have LAMP communcating properly and that there are no config files messed up. I took the zipped Moodle 1.53+ and extracted the moodle folder contents into a /var/www/html/cats folder. When I point my browser there (locally or remotely) I get the install.php asking me which language. But the next screen asking for:
Web Address
Moodle Directory
Data Directory

fails with red writing saying: "The 'Data Directory' you specified could not be found or created. Either correct the path or create that directory manually."

The data directory path is /home/moodledata owned by apache with permissions 777. (I have also tried using several other owners and mods). I know PHP is working because I inserted phpinfo() near the top of moodle's install.php and it lists all the tables before showing me the red text error message. I can also see the php var tablews when I insert the phpinfo() into my home page at wwwroot (ikm.york.edu/index.php)

Once '/var/www/html/moodledata' was accepted by the install.php script but then it said (in red writing) the web address of http://ikm.york.edu/cats was not where the moodle program was. But that is where it is and was accessible from an external computer infophp() shows the DOCUMENT_ROOT: /var/www/html which is where the cats (moodle home) folder is. The http SERVER[host?] also says the same.

I am running out of options. Any more suggestions?
In reply to Rob Byrd

Re: Site is down! I've checked ...What else

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I don't know Fedora Core that much, but I suspect (but can't confirm) that your Web server is running in a chroot environment and/or under the SELinux security model, which greatly restricts what a given process can do and can access.

I seem to remember a handful of posts here in the moodle forums (try the search engine) which talked about this.

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Site is down! I've checked ...What else

by Rob Byrd -
I considered SELinux as a possibility and when I repartitioned an formatted the system before reinstalling moodle the second time, I changed the SELinux setting to "warn" only. All my folder permissions are area at least 755.

Here is how I have made some progress:
I edited the install.php file, commenting out the wwwroot, dirroot, and dataroot test actions and, rather than letting install.php try to guess the correct values (since I knew it  couldn't tell correct ones from incorrect onse anyway-- on my machine at least), I put simple echos  (e.g. if correct echo 'correct dataroot',  else echo 'wrong dataroot';)

this got me to most of the rest of the install process with scrolling screens of table craetions, etc. (and green text saying 'sucessful' smile

There are only a couple problems:
1. It said it couldn't create or find the cache
2. It said it couldn't create or find the session
Both of these directories, however were created.  cache has nothing in it, but session has a file name that looks long and encrypted.

I can see the correct main page at ikm.york.edu/moodle and can created a user by sending myself a "help with password" email. moodle sent me a password. The moodleuser password doesn't work, though, and I can't login as admin. So, I can't create any courses.

I can list the 132 tables that were created by the install process. How can I change the encrypted password field in the mdl_user for the admin? And if I get admin to login, how will I be able to restore the 16 courses that I have backed up on CDs? ie which new files do I not want to overwrite?

Thanks,

Rob


In reply to Rob Byrd

Re: Site is down! I've checked ...What else

by Rob Byrd -
I can now log in as admin, add courses, and edit the main page. I did it by deleting and recreating the database, deleting the config.php, and running my rewritten (described above) install.php.  It was truly a miracle!  I did not change a single server setting, only the install.php code.  Maybe Dr Dougiamas should look at this to see whether there is a way to automate it somehow.

Now, how can I append the 132 databases with my backed up databased from before the error, and put all the user and course directories (that were name numners 1, 2, etc.). Can I overwrite the moodle databse with the backup, or are there settings that won't work if I do that, etc.?

Thanks to everyone for all your suggestions and help in solving this problem. I appreciate you all.

Rob


In reply to Rob Byrd

Re: Site is down! I've checked ...What else

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Just to clarify, what do you call 'databases'? There is only one database in Moodle, so talking about your 132 databases got me really confused.

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Site is down! ...It's Fixed!! Thank you moodle Forum

by Rob Byrd -
Thank you, Inaki, for your detailed, concise, and accurate help with my moodle restore problem. It worked! The only thing I did different was dump the moodledb as root rather than moodleuser (because of a FILE LOCK?? issue). Everything else went just by the numbers.

You have truly been a blessing. Thank you,

Rob