301: Fixing common errors when installing MoodleWritten by James Richardson
When installing Moodle 2.3, several errors can occur during the installation. Typical Moodle installation errors are caused by database encoding, PHP version, and the database version. The PHP errors thrown are the Use of undefined constant, Database driver, and Database unicode errors. This article will explain what causes these errors and how to fix them.
Error: Use of undefined constant PHP
This error is caused by installing Moodle on a server with an incorrect version of PHP. An example of this error is similar to the following.
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /home/user/public_html/lib/dml/moodle_database.php on line 27
Warning: require_once(__DIR__/database_column_info.php) [function.require-once]:
failed to open stream: No such file or directory in /home/user/public_html/lib/dml/moodle_database.php on line 27
Fatal error: require_once() [function.require]: Failed opening required '__DIR__/database_column_info.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php:/home/user/php') in /home/user/public_html/lib/dml/moodle_database.php on line 27
If you are on a shared business plan, you can have your account moved to a PHP 5.3 server. On VPS or Dedicated servers, the PHP version can be upgraded. In either case, contact support to request the server move or PHP upgrade.
Error: Database driver problem detected
The database driver error is caused by an outdated version of MySQL. The following is copy of the error.
Error: database driver problem detected
The site administrator should verify server configuration
PHP has not been properly configured with the MySQLi extension so
that it can communicate with MySQL. Please check your php.ini file
or recompile PHP. MySQLi extension is not available for PHP 4.
Fixing this error will depend on the type of server you are one. If you are on a Shared business plan, you will need to move to a server that supports MySQL version 5.1 or higher. Systems can move your account to a server that supports this. On a VPS or Dedicated, tech support can upgrade the MySQL version for you by submitting a ticket.
Error: Database unicode character
When installing Moodle on a new database, if the encoding is not set correctly, the following error will occur.
It is required that you store all your data in Unicode format (UTF-8).
New installations must be performed into databases that have their default
character set as Unicode. If you are upgrading, you should perform the
UTF-8 migration process (see the Admin page).
To fix this error, you will need to set the database collation in to utf8_unicode_ci through PhpMyAdmin. The following will explain how to do this.