Elgg installation fails because database is not filled automatically

Hey Guys,

I am currently trying to install Elgg 2.0.4 on an Ubuntu 16.04 machine with an Apache2 server, PHP 5.6 and MySQL 5.6. I got everything running except Elgg. When I first navigated to the URL of my Elgg installation, I got a blank page with only an exception message displayed instead of the expected installation steps. This one was caused by non-existent tables in my previously generated empty database (I did that through Ubuntu terminal instead of using PHPMyAdmin), so to fix it, I copied the statements from elgg-2.0.4\vendor\elgg\elgg\engine\schema\mysql.sql to the terminal to create the empty database tables.

Now when calling the Elgg URL, the page is completely blank showing nothing at all and in the apache2 logs I get the following entry:

Exception #1473159534: exception 'InstallationException' with message 'Unable to handle this request. This site is not configured or the database is down.' in /var/www/html/vendor/elgg/elgg/engine/lib/configuration.php:271\nStack trace:\n#0 /var/www/html/vendor/elgg/elgg/engine/lib/elgglib.php(1911): _elgg_load_site_config() \n #1 [internal function]: _elgg_engine_boot('boot', 'system', NULL)

It looks to me as if the tables are not automatically filled with initial values resulting in the parameter NULL instead of what I'd expect to be the site guid. MySQL is up and running so I guess there is some script failing which should set those values for the site configuration.

Anyone had a similar problem? Any tip might be useful.

I already successfully installed Elgg 2.0.4 on a different machine using PHP 7 and MySQL 7, but got several exception messages throughout the site so I need an installation with the older versions.

Thanks in advance


  • Sorry to say importing mysql.sql will not work. Drop the DB tables, remove your settings.php file, and try the installer again. Post the exceptions you get here, happy to help.

  • Hey Steve, thanks for your tip which led me to the solution.

    The exception I got after following your advice was:

    PHP Fatal error:  Class 'DOMDocument' not found in /var/www/html/vendor/elgg/elgg/engine/classes/ElggAutoP.php on line 89

    So I checked my setup and installed the missing php5.6-xml package, but the Error would still show up. I then compared the PHP packages of my new machine with the packages of the old functioning installation and noticed that the 'gd' and 'mcrypt' packages were not installed on my new machine. Maybe something got messed up because I had to add the apt-repository for PHP 5.6 manually.

    Installing the missing packages fixed the error and I can now use the installer.

  • So the installer didn't check for those requirements? We need to fix that.

  • Seems like there is no such check. A fix for that could definitely save a lot of debugging time since the log entries in this case weren't really helpful.

    I will just leave an exception log here, which might also be of interest for that fix and first made me spend quite some time trying to fix a database problem that wasn't actually there:

    Exception #1472728435: exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'elgg.datalists' doesn't exist' in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:104\nStack trace:\n#0 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(104): PDO->query('SELECT value FR...')\n#1 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(935): Doctrine\\DBAL\\Driver\\PDOConnection->query('SELECT value FR...')\n#2 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Database.php(589): Doctrine\\DBAL\\Connection->query('SELECT value FR...')\n#3 /var/www/html/vendor/elgg/elgg/engine/lib/elgglib.php(1907): Elgg\\Database->assertInstalled()\n#4 [internal function]: _elgg_engine_boot('boot', 'system', NULL)\n#5 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php(66): call_user_func_array('_elgg_engine_bo...', Array)\n#6 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Application.php(252): Elgg\\EventsService->trigger('boot', 'system')\n#7 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Application.php(402): Elgg\\Application->bootCore()\n#8 /var/www/html/vendor/elgg/elgg/engine/classes/Elgg/Application.php(360): Elgg\\Application->run()

    Exception #1472728435 : fatal error in exception handler : An exception occurred while executing 'SELECT value FROM config\n\t\t\tWHERE name = 'cookies' AND site_guid = 0':\n\nSQLSTATE[42S02]: Base table or view not found: 1146 Table 'elgg.config' doesn't exist\n\n QUERY: SELECT value FROM config\n\t\t\tWHERE name = 'cookies' AND site_guid = 0

    This occurred while calling the Elgg site URL with an empty database named 'elgg' and a settings.php file with filled in DB connection data in the elgg-config directory and before installing the missing PHP packages from above.