I'm a beginner at Moodle, though I'm helping a friend run a newish installation of Moodle. I'm in need of help for resolving a strange error condition: when I point my web browser at the Moodle installation of a site I run, the only thing that is displayed is this text within a frame with rounded corners:
Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
Background: the server that the Moodle instance was running on had been restarted earlier today by the hosting company, because its memory had become full. I don't know the exact symptoms, as the Moodle crash been discovered by my friend, who called the hosting company. Anyway, after the server restart, Moodle still wasn't available. I logged into the server, and noticed that while the httpd service was running, the mysqld service wasn't, so I restarted it. Moodle started functioning normally again.
httpd and mysqld have been running ever since, except when I restarted mysqld to try to fix the problem described herein. This didn't fix the problem.
About four hours after server restart, my friend, who had meanwhile been using Moodle to create users and other data entry, called me to tell me Moodle had crashed again. (Later, I found out what that he meant was the symptom described at the beginning: the only thing he got when going to the Moodle page was the "Coding error" message.) I logged into the server again, and checked the server's and MySQL's uptime; both had been up since the restart earlier today. I pointed my browser at the Moodle instance, and logged in as myself, and Moodle seemed to work fine. (I'm a secondary administrator, while my friend is the Moodle instance's primary administrator.) When my friend's spouse logged in, she saw the the same error.
I logged out of Moodle, and at the login page, tried to log in as my friend (I have his username and password). Now, I also saw the problem described at the beginning, and starting from this point on, no matter what URL under the Moodle installation I try to see, the only thing I see is this error message. This is strange: the problem started manifesting itself for me only after this attempt to login as my friend. Before that, it was working fine for me, but not for the two other users who tried to use Moodle.
I have been searching this forum and the wider internet, and while I've found other bug descriptions that involve the error message "Coding error detected, it must be fixed by a programmer: PHP catchable fatal error", they all seem to be displayed within a Moodle page, and do not involve the whole thing becoming unusable.
Further information on the setup -- please tell me if any other information is needed:
Moodle installation: v2.3.0, with version MDL_23 of the Attendance module, and version MDL_20 of the Attendance block installed (see http://docs.moodle.org/23/en/Attendance_module), but with no other plugins installed. I have not edited any of the Moodle installation's files, including the .php files.
OS: CentOS release 5.8 (Final); 1 GB of memory; 200 GB of disk.
The contents of file /proc/cpuinfo:
processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 26 model name : Intel(R) Xeon(R) CPU E5520 @ 2.27GHz stepping : 5 cpu MHz : 2260.998 cache size : 8192 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu de tsc msr pae cx8 apic sep cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc pni ssse3 cx16 sse4_1 sse4_2 popcnt lahf_lm bogomips : 5656.30 clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management:
The final lines of file /var/log/mysql.log (MySQK started at about 15:33, then restarted at about 20:41; the 28 August message was the latest in a long series of similar messages):
120828 22:48:04 InnoDB: Error: page 932 log sequence number 80233384 InnoDB: is in the future! Current system log sequence number 69043522. InnoDB: Your database may be corrupt or you may have copied the InnoDB InnoDB: tablespace but not the InnoDB log files. See InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html InnoDB: for more information. 120905 15:33:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 120905 15:33:48 [Note] Plugin 'FEDERATED' is disabled. 120905 15:33:48 InnoDB: The InnoDB memory heap is disabled 120905 15:33:48 InnoDB: Mutexes and rw_locks use GCC atomic builtins 120905 15:33:48 InnoDB: Compressed tables use zlib 1.2.3 120905 15:33:48 InnoDB: Using Linux native AIO 120905 15:33:48 InnoDB: Initializing buffer pool, size = 128.0M 120905 15:33:48 InnoDB: Completed initialization of buffer pool 120905 15:33:48 InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 120905 15:33:48 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 120905 15:33:49 InnoDB: Waiting for the background threads to start 120905 15:33:50 InnoDB: 1.1.8 started; log sequence number 183272264 120905 15:33:51 [Note] Event Scheduler: Loaded 0 events 120905 15:33:51 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.5.25' socket: '/var/lib/mysql/mysql.sock' port: 0 MySQL Community Server (GPL) 120905 20:41:33 [Note] /usr/libexec/mysqld: Normal shutdown 120905 20:41:33 [Note] Event Scheduler: Purging the queue. 0 events 120905 20:41:33 InnoDB: Starting shutdown... 120905 20:41:34 InnoDB: Shutdown completed; log sequence number 216165142 120905 20:41:34 [Note] /usr/libexec/mysqld: Shutdown complete 120905 20:41:34 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 120905 20:41:34 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 120905 20:41:34 [Note] Plugin 'FEDERATED' is disabled. 120905 20:41:34 InnoDB: The InnoDB memory heap is disabled 120905 20:41:34 InnoDB: Mutexes and rw_locks use GCC atomic builtins 120905 20:41:34 InnoDB: Compressed tables use zlib 1.2.3 120905 20:41:34 InnoDB: Using Linux native AIO 120905 20:41:34 InnoDB: Initializing buffer pool, size = 128.0M 120905 20:41:34 InnoDB: Completed initialization of buffer pool 120905 20:41:34 InnoDB: highest supported file format is Barracuda. 120905 20:41:34 InnoDB: 1.1.8 started; log sequence number 216165142 120905 20:41:34 [Note] Event Scheduler: Loaded 0 events 120905 20:41:34 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.5.25' socket: '/var/lib/mysql/mysql.sock' port: 0 MySQL Community Server (GPL)
The contents of file /var/www/html/moodle/config.php:
<?php // Moodle configuration file unset($CFG); global $CFG; $CFG = new stdClass(); $CFG->dbtype = 'mysqli'; $CFG->dblibrary = 'native'; $CFG->dbhost = 'localhost'; $CFG->dbname = 'moodle'; $CFG->dbuser = 'moodleuser'; $CFG->dbpass = 'PASSWORD REDACTED; $CFG->prefix = 'moodle_'; $CFG->dboptions = array ( 'dbpersist' => 0, 'dbsocket' => 1, ); $CFG->wwwroot = 'http://WEBSITE ADDRESS REDACTED/moodle'; $CFG->dataroot = '/var/moodledata'; $CFG->admin = 'admin'; $CFG->directorypermissions = 0777; $CFG->passwordsaltmain = 'PASSWORD REDACTED'; require_once(dirname(__FILE__) . '/lib/setup.php'); // There is no php closing tag in this file, // it is intentional because it prevents trailing whitespace problems!
The contents of file /var/www/html/moodle/version.php:
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . /** * MOODLE VERSION INFORMATION * * This file defines the current version of the core Moodle code being used. * This is compared against the values stored in the database to determine * whether upgrades should be performed (see lib/db/*.php) * * @package core * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $version = 2012062500.01; // 2012062500 = branching date YYYYMMDD - do not modify! // RR = release increments - 00 in DEV branches // .XX = incremental changes $release = '2.3+ (Build: 20120701)'; // Human-friendly version name $branch = '23'; // this version's branch $maturity = MATURITY_STABLE; // this version's maturity level
The contents of MySQL configuration file /etc/my.cnf:
[client] socket = /var/lib/mysql/mysql.sock port = 3306 [mysqld] datadir = /var/lib/mysql socket = /var/lib/mysql/mysql.sock port = 3306 user = mysql symbolic-links = 0 # Disabling symbolic-links is recommended to prevent assorted security risks innodb_buffer_pool_size = 128M skip_networking # Only local processes need to use MySQL key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer = 1M net_buffer_length = 16K myisam_sort_buffer_size = 16M [mysqld_safe] log-error = /var/log/mysqld.log pid-file = /var/run/mysqld/mysqld.pid
The output of command ulimit -a:
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 8192 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 8192 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
The output of command free:
total used free shared buffers cached Mem: 1048576 876272 172304 0 93376 166144 -/+ buffers/cache: 616752 431824 Swap: 0 0 0
Following the advice given at http://docs.moodle.org/23/en/Debugging, I then added lines
$CFG->debug = 38911; $CFG->debugdisplay = true;
to file /var/www/html/moodle/config.php, then tried opening page http://WEBSITE ADDRESS REDACTED/moodle again. The familiar error message was still there, but now followed by debugging information:
Coding error detected, it must be fixed by a programmer: PHP catchable fatal error Debug info: Argument 2 passed to has_capability() must be an instance of context, boolean given, called in /var/www/html/moodle/lib/navigationlib.php on line 1134 and defined Error code: codingerror Stack trace: line 397 of /lib/setuplib.php: coding_exception thrown line 355 of /lib/accesslib.php: call to default_error_handler() line 1134 of /lib/navigationlib.php: call to has_capability() line 3036 of /lib/navigationlib.php: call to global_navigation->initialise() line 778 of /lib/pagelib.php: call to navbar->has_items() line 4 of /theme/base/layout/general.php: call to moodle_page->has_navbar() line 765 of /lib/outputrenderers.php: call to include() line 712 of /lib/outputrenderers.php: call to core_renderer->render_page_layout() line 146 of /my/index.php: call to core_renderer->header()