Hi all,
I'd like to relate a few things I learned, in the hope it will help others.
500 Internal Server Error is just dreadful. It usually comes up after a long wait, such as a backup or restore. And the error_log files in the moodle directories usually have no clues.
I had this situation while migrating from a messy Moodle 2.4.2 installation to a clean 2.4.9. Messy in that it had a long history of ad-hock changes.
I should also say that I am using a hostmonster dedicated server which runs centos linux. In principle, I have the whole CPU to myself and no usage limits.
I got the 500 Internal Server Error error while restoring a moderately large course, about 53 megs.
Lesson learned:
1) Check the Apache log file. /usr/local/apache/logs/error_log
While looking at the apache log file, search for your ip address. That is, the address of the computer that you use to browse the web. Look for the last thing that happened that you did. (This is to ignore all other users accessing your web site.) (To find out your ip address google "what is my ip" or ask ipchicken")
Anyhow, this gave me (and the very competent hostmonster tech support guy) a clue: the problem was associated with a thing called mod-gcgid.
2) Moodle uses php heavily, and which php engine is used can make a difference.
It turns out that there are four such engines available to hostmonster users, and they can be exchanged.
On Hostmonster, the procedure to do that is to log into www.yoursitename/whm as ROOT (not your regular username). whm is a control panel similar to cpanel. It does not replace cpanel. It is in addition to cpanel.
tech suppert guided me to a part of the whm control panel called "Configure PHP and suEXEC"
In there he had me switch php engines from fcgi to suphp.
Problem solved.
3) I don't know whether to celebrate or cry. But I'm glad that it finally works.
I have been bothered by this problem for a long long time. See:
https://moodle.org/mod/forum/discuss.php?d=252411
---Peter Halverson
PS: I would like to thank Ken Task for the very helpful suggestion of using the automated backup feature for working around the 500 Internal Server Error while doing backups.