Forums | Mahara Community

Support /
Fresh WAMP/Mahara install fails


anonymous profile picture
Account deleted
Posts: 17

05 March 2014, 7:59

Hi Folks (new here)

I've got the WAMP server running and when I go to install Mahara i receive (what appears to be a a common error) judging from the "Read me first".

Could not execute command: CREATE TABLE config (    field VARCHAR(255) NOT NULL,    value TEXT, CONSTRAINT  PRIMARY KEY (field) )ENGINE=innodb

Here are some examples of what I see when I look in the apache_error.log but I'm not sure what they mean.....This environment is all brand spankin new to me.

[access_compat:error] [pid 1432:tid 1516] [client 119.63.196.62:11328] AH01797: client denied by server configuration: C:/wamp/www/cmesg

and

[:error] [pid 1432:tid 1516] [client 127.0.0.1:49313] [WAR] cd (C:\\wamp\\www\\mahara\\lib\\mahara.php:818) Invalid argument supplied for foreach(), referer: localhost/mahara/admin/index .php

and

 [:error] [pid 1432:tid 1516] [client 127.0.0.1:49313]   * load_config() at C:\\wamp\\www\\mahara\\init.php:171, referer: localhost/mahara/admin/index.php [Mon Mar 03 10:56:09.901605 2014] [:error] [pid 1432:tid 1516] [client 127.0.0.1:49313]   * require("C:\\wamp\\www\\mahara\\init.php") at C:\\wamp\\www\\mahara\\admin\\upgrade.php:16, referer: /localhost/mahara/admin/index.php [Mon Mar 03 10:56:09.901605 2014] [:error] [pid 1432:tid 1516] [client 127.0.0.1:49313] , referer: /localhost/mahara/admin/index.php [Mon Mar 03 10:56:11.026813 2014] [:error] [pid 1432:tid 1516] [client 127.0.0.1:49313] [INF] cd (C:\\wamp\\www\\mahara\\admin\\upgrade.php:38) Starting Mahara installation..., referer:) localhost/mahara/admin/index.php

If any of these errors are obvious to anyone please feel free to pass on any wisdom

Thanks a bunch

Cheers

Aaron Wells's profile picture
Posts: 896

05 March 2014, 12:35

The first thing Mahara does on installation is try to create all the necessary database structures. The error "Could not execute command: CREATE TABLE config (    field VARCHAR(255) NOT NULL,    value TEXT, CONSTRAINT  PRIMARY KEY (field) )ENGINE=innodb", tells us that it failed to run the SQL command to create the database structures, and consequently nothing else is going to work.

Is there another SQL error message immediately below the "Could not execute" one saying why it couldn't execute the command?

Cheers,

Aaron

anonymous profile picture
Account deleted
Posts: 17

06 March 2014, 3:17

Adam thanks for your help on this, it is without doubt appreciated....

Here is what is directly below "Could not execute"

execute_sql("CREATE TABLE config (    field VARCHAR(255) NOT N...") at C:\wamp\www\mahara\lib\dml.php:1388

  • execute_sql_arr(array(size 255)) at C:\wamp\www\mahara\lib\ddl.php:755
  • install_from_xmldb_file("C:\wamp\www\mahara/lib/db/install.xml") at C:\wamp\www\mahara\lib\upgrade.php:291
  • upgrade_core(object(stdClass)) at C:\wamp\www\mahara\admin\upgrade.json.php:78

 

Aaron Wells's profile picture
Posts: 896

06 March 2014, 11:06

Unfortunately that doesn't really shed any light on the problem. What we need is a SQL error message that shows what MySQL didn't like about the query -- a syntax issue, a permissions problem, etc.

The next thing you could try, is to execute the query directly in MySQL, as the user that you're connecting to Mahara as. WAMP should provide you with some mean to run SQL queries directly against the database, probably phpmyadmin. The query you should try is the one from your previous message:

   CREATE TABLE config (    field VARCHAR(255) NOT NULL,    value TEXT, CONSTRAINT  PRIMARY KEY (field) )ENGINE=innodb;

If that doesn't give you anything helpful, well, a lot of people have success by just deleting their Mahara installation and trying it again clean.

Cheers,

Aaron

anonymous profile picture
Account deleted
Posts: 17

06 March 2014, 12:40

Thanks, I thought that may be the case.
Would it help if I pasted the apache_error log when I'm back in the office in the morning? The sql log didn't show much but I need to look again to be sure.

(Without having the apache log in front of me) I recall an error early in the install complaining about an "invalid argument foreach () " or something along those lines...

On the other suggestion, I was able to execute that query via phpmyadmin manually... I've since deleted and re-created that DB in subsequent attempts to weed out problems.
Cheers
anonymous profile picture
Account deleted
Posts: 17

07 March 2014, 3:35

Here are a few examples of what I'm seeing in the apache_error.log

 

[Wed Mar 05 09:10:00.854854 2014] [:error] [pid 2976:tid 1500] [client 127.0.0.1:49301] [WAR] eb (C:\\wamp\\www\\mahara\\lib\\mahara.php:818) Invalid argument supplied for foreach(), referer: http://localhost/mahara/admin/index.php


[Wed Mar 05 09:10:00.854854 2014] [:error] [pid 2976:tid 1500] [client 127.0.0.1:49301] Call stack (most recent first):, referer: http://localhost/mahara/admin/index.php


[Wed Mar 05 09:10:00.854854 2014] [:error] [pid 2976:tid 1500] [client 127.0.0.1:49301]   * log_message("Invalid argument supplied for foreach()", 8, true, true, "C:\\wamp\\www\\mahara\\lib\\mahara.php", 818) at C:\\wamp\\www\\mahara\\lib\\errors.php:430, referer: http://localhost/mahara/admin/index.php


[Wed Mar 05 09:10:00.854854 2014] [:error] [pid 2976:tid 1500] [client 127.0.0.1:49301]   * error(2, "Invalid argument supplied for foreach()", "C:\\wamp\\www\\mahara\\lib\\mahara.php", 818, array(size 5)) at C:\\wamp\\www\\mahara\\lib\\mahara.php:818, referer: http://localhost/mahara/admin/index.php


[Wed Mar 05 09:10:00.854854 2014] [:error] [pid 2976:tid 1500] [client 127.0.0.1:49301]   * load_config() at C:\\wamp\\www\\mahara\\init.php:171, referer: http://localhost/mahara/admin/index.php


[Wed Mar 05 09:10:00.854854 2014] [:error] [pid 2976:tid 1500] [client 127.0.0.1:49301]   * require("C:\\wamp\\www\\mahara\\init.php") at C:\\wamp\\www\\mahara\\admin\\upgrade.php:16, referer: http://localhost/mahara/admin/index.php

Robert Lyon's profile picture
Posts: 749

07 March 2014, 6:57

Hi Clint,

 

Ok, looking at the errors it says that the foreach() problem is in lib/mahara.php on line 818.

Looking at that line there it is a foreach loop that loop through the config settings.

The error can happen if the $CFG array is empty or malformed in some way.

This could mean that your config.php file has an error, or is not being 'read' by Mahara.

If you add in this:

  log_debug($CFG);

just before the line 818 in lib/mahara.php you can check what (if any) $CFG settings are existing before the foreach line. It should be an array.

Cheers

Robert

 

anonymous profile picture
Account deleted
Posts: 17

07 March 2014, 10:15

Robert, first of all thanks.

Below is the beginning of my config.php

Is the section highlited in red causing my error or am I heading in the wrong direction?

This file includes only the most commonly used Mahara configuration directives. For more options  * that can be placed in this file, see the Mahara lib file  *     htdocs/lib/config-defaults.php  */

$cfg = new stdClass();

/**  * database connection details  * valid values for dbtype are 'postgres' and 'mysql'  */ $cfg->dbtype   = 'mysql5'; $cfg->dbhost   = 'localhost'; $cfg->dbport   = null; $cfg->dbname   = 'mahara'; $cfg->dbuser   = 'root'; $cfg->dbpass   = '';

I haven't had a chance to add the log_debug($CFG); before line 818 in lib.mahara.php yet but I will get at it in the morning.

Thankns again for the help

 

07 March 2014, 21:35

Hello Clint,

I am reading again this post and I notice a little thing that raises a question: is your Mahara a production server. If yes, I would advise to not use the 'root' user for mysql but to create a specific one with limited rights and more over with a password.

Regards,

-dajan

anonymous profile picture
Account deleted
Posts: 17

08 March 2014, 6:01

Hi

Thanks for the advice on "root" user.

It is not yet on a production server but that is my hope if I can get it running successfully.

Cheers

13 results