Does anyone know, what's going wrong? Thanks for any support!
Fritz
Hi all. I saw the same "could not find a top level course" error upon installing the latest moodle 2.0 (as of Dec 15th 2010). Any suggested solutions?
Thank you,
Steve
Hi, I got the same error after the server checkings, I was trying to install moodle 2.0.1 on a localhost server.
I tried several times from scratch, same error shows up: could not find a top-level course ??
I'll try with an older version (1.9.10), because I'm stucked now.
This problem stems from PHP caching. Clear out any PHP cache you're running before you attempt the install or upgrade. (Restarting Apache will do it if you're unfamiliar)
pardon the ignorance, i haver googled but could not find an solution. but how do you "Clear out any PHP cache you're running" ??
i have server 03, IIS 6, php 5.3 (restarting IIS does not seem to matter)
i have a phpinfo page but i dont know what i am supposed to look for on it, its huge.
If I have just installed Moodle on a localhost for the first time (not yet run), there should not be any php caching, should there?
just fyi (I haven't seen this yet), I right clicked the moodle start icon and selected run as... I did not have to change the user, but did uncheck the "protect my computer..." box. So far, that seems to have worked.
The same problem was faced by me. But after doing these steps i Get out of this Problm Guys.
1) Deleted the Old Database and All old Moodle Files from Hosting.
2) Again Extracted the Moodle to the Hosting.
3) Created the Database and user.
4) Finally used the New Database details for Installation.
5) Yhis time i didn't get the ERROR.
Installation Completed Sucessfully Guys.
Did all that a gazillion times. No good.
Up to now, February 2012 - no answer about this problem which either means...nobody knows the solution or everyone already solved it.
I'm seriously thinking about another Learning Management. Any suggestions?
Hi Ricardo,
What version of Moodle are you using? I can confirm that the problem has been fixed in Moodle 2.1 onwards.
Hi
I've just installed 2.2.1+ on windows, php 5.3.6 / MySQL 5.5.
Tracked down the source of the error but none the wiser...
ln 354 in lib/datalib.php
if ($course = $DB->get_record('course', array('category'=>0))) {
return $course;
} else {
echo('Assignment in condition');
// course table exists, but the site is not there,
// unfortunately there is no automatic way to recover
throw new moodle_exception('nosite', 'error');
}
"solved" my problem by installing on a linux box - would sill like a solution though if anyone can help?
I solved this issue by looking up the "front page" course. I noticed that the category was set to 1 instead of 0. I updated the record and the site was accessible again.
Update mdl_course set category = '0' where format = 'site' and id = 1;
Hope this helps the rest of you.
Hi,
I'm also having the same problem. When I finished installing all the prequisites of moodle. Suddenly it dispaly the error that there's no course in the database.
When I tried Miguel's way, I found that my course table is empty. So I can't change anything in it.
I'm using php 5.5, moodle 2.2, apache server and mysql 5.2
Thanx for any of your help
I'm having the same trouble as Richard with Moodle 2.2 Build 20120312 on a hosted service (Dreamhost)
I'm also seeing this error: Moodle 2.1.4 on Hostmonster.
The error occurs right after the "does your server meet the requirements" check page.
It was fixed by the "Update mdl_course set category = '0' where format = 'site' and id = 1;" SQL command, but it seems like there is something odd in the initial config.
Thanks, Miguel. That fixed it for me!
Thanks Miguel!
I got the same error after the servers checking when I install moodle 2.2.4 on a localhost server which setup by wampserver2.2 in win7.
I found that the category was set to 0 while the visible was set to 1 instead of 0, and the site was accessible after the record change.
Hi Miguel,
Even I am facing the same problem "Could not find a top-level course!". I am new to moodle. I got this messege once I finished the installation.
I am trying to fix this using the solution mentioned by you but my mdl_course table is empty. Infact I think all my tables are empty.
Can you pleas suggest any solution. Where am I going wroong?
Thank you.
Hi,
I have not encountered the mdl_course table being empty. Are you upgrading an existing moodle site, or starting from scratch? If you are starting from scatch you could create the record via SQL.
insert into mdl_course (id, category, sortorder, fullname, shortname, idnumber, summary, summaryformat, format, showgrades, modinfo, newsitems, startdate, numsections, marker, maxbytes, legacyfiles, showreports, visible, visibleold, hiddensections, groupmode, groupmodeforce, defaultgroupingid, lang, theme, timecreated, timemodified, requested, restrictmodules, enablecompletion, completionstartonenrol, completionnotify)
Value
( 1, 0, 1, 'moodle2', 'moodle2', '', '', 0, 'site', 1, 'a:0:{}', 3, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0);
Hello. I had same problem. I fixed it.
it is a time out problem. if server time out shortly appear this problem when installing. You want help your hosting administrator. he must make time out more long, will not be any problem when installing...
I hope it be help for you.
Erdal has the answer. I'll just paraphrase so that it is easier to understand:
I had the same problem with version 2.0. The error happened right after the "Server Checks" stage (where everything was reported as "OK"). So I searched the error log files for the nature of the error and found lines like these:
Removed because dumb spam settings see error log information as spam, apparently. Someone should do something about the spam sensitivity settings here.
Moodle needs sufficient time to set up and create all the database tables.
Now, my domain is hosted on a Linux server managed by Parallels Plesk. I do not have access to the php.ini files in this shared virtual host environment. So I wrote to the host administrators to increase the max_execution_time and gave them the lines above to verify that the timeout was indeed too short.
The administrators fixed that and then I managed to get to the table creation page. But the waiting time was indeed quite long. This I understand may be because of the amount of memory allocated. From what I see, I am allocated 32MB, which is insufficient for operation to work fast enough. I have now requested memory_limit be increased to 128MB which I understand should be sufficient. I have yet to test that to see if that speeds up the process, but at least now, I am able to get all the way to the moodle front page successfully.
All the best.
I also had this issue but it was my own fault. I accidentally restarted ISS while it was provisioning the database.
I decided to drop all of the tables from the database. What I didn't expect, and luckily curiousity got the best of me, was that all I had to do was try to browse to the admin directory and it reprovisioned them automatically.
I have also been struggling with this issue for ... oh, a long time. I would first get a FastCGI error (timeout) and then, upon refreshing my browser, get a "Could not find a top-level course!" error message. FastCGI is set to time-out after only 70 seconds, I think I read somewhere, much, much too short for a giant install like Moodle. It's normally set to this default to prevent waiting for a CGI foul-up that will never actually resolve on its own. So ... I deleted all tables in my database using "PHPMyAdmin", available free for download. I could have just deleted the database itself instead - either one would have done. I then inserted "ActivityTimeout=600" (10 minutes) into the PHP section (bottom) of fcgiext.ini (without the ";" symbol) (found in the c:- windows- system32- inetsrv- folder). This, I thought, should prevent a timeout. Same results, but something new - I saw more database tables were created - many more than before - which suggested that it was actually still installing but got interrupted after 5 minutes. According to some webs, Moodle 2.something setup should take about 15 minutes on some computers, so my thinking is that 20 minutes ought to do it. I changed the "ActivityTimeout" setting to 1200 seconds (20 minutes). I went back to the URL of the Moodle site and began installation again, building the database tables from scratch. Guess what - SUCCESS. My database was built, and FastCGI didn't time-out. I hope this helps. Good luck to everyone in the wonderful world of DIY websites.
To solve the problems, you must change the max_execution_time parameter in php.ini. The php.ini is located in usr/local/php5/php.ini
try to put values:
max_execution_time = 3000
max_input_time = 600
After all, remove the base moodle data directory Moodle, Moodle and try reinstalling again.