Forums | Mahara Community

Support /
Can't configure dataroot on virtual host

anonymous profile picture
Account deleted
Posts: 6

19 October 2011, 13:39


I installed Mahara 1.4 (downloaded from on a virtual host:, Windows, Apache, MYSQL, PHP 5.3.

I am experiencing the issue where I am being continually asked to log into Mahara.  I saw this issue addressed in the Troubleshooting guide and  so I inserted this line into index.php: 

echo getcwd();

which returns: 


but what I have defined in my config.php is:

$cfg->dataroot = '/home/<USERNAME>/maharadata';

So my question is, why is the virtual host of "" being tacked onto the dataroot directory when it is not included in the dataroot?

I have also tried lots of other permutations like, /public_html/<USERNAME>/maharadata, /www/<USERNAME>/maharadata, /maharadata, <USERNAME>/maharadata, etc.

Thanks so much for any help.


François Marier's profile picture
Posts: 411

19 October 2011, 18:14

Hi China,

Have you tried setting the $cfg->wwwroot variable explicitly (to the URL that you site is on) in your config.php?



anonymous profile picture
Account deleted
Posts: 6

20 October 2011, 9:31


Thank you for your reply.

I just tried to set the $cfg->wwwroot variable to my installed virtual host URL: but it didn't effect the printed value of the "echo getcwd();" command, so it still shows: 


when what I want to see is:


I wonder what else I could try or what other input I can use for both the "wwwroot" and "dataroot" values?

Thanks again.

anonymous profile picture
Account deleted
Posts: 6

20 October 2011, 11:59

Hi...I am sorry, I think I misunderstood the purpose of what getcwd returns.  I looked it up and it returns the current working directory, so in fact the returned value is correct for my installation.  

I thought that it was returning my dataroot directory, so I was mistaken and my install is working in that regard.

What is not working is that I am being asked to log in on every Mahara page.

I am currently trying to figure out if a Server Alias is causing the problem. 

When I know more, I will post here to try to help future Mahara installers.

anonymous profile picture
Account deleted
Posts: 6

20 October 2011, 16:41

Okay, spent awhile today trying to figure this out.  In the Troubleshooting guide they specify:

"extra VirtualHost instead of many ServerAliases"

but in the code snippit they provide there is no reference to "VirtualHost" so I am confused about what exact text to add.

Also, if I add the code snippit, which file do I add it to?  And where is that file located.

I am managing my mahara install through a GUI CPanel.

I feel so close to the solution, hopefully I can get it fully functional soon!

Thanks again.

anonymous profile picture
Account deleted
Posts: 21

21 October 2011, 4:17

Maybe I missed something there, but you're saying that it's on a Windows machine and looking for the dataroot at "/home/<USERNAME>/public_html/". That's the format for UserDir on Linux/Unix, you'd normally see that if you were using something like "".
Shouldn't it be more like "C:\Users\<USERNAME>\..." on Windows?

Repeatedly asking for login details is a sign of not being able to write to the filesystem to create the session, which is consistent with the dataroot being wrong. Would you be able to post your Mahara config, and the ServerName part of the config you're using for Apache?

ServerAliases are normally used when you want to give a VirtualHost more than the one name, it's saying that this breaks the authentication in Mahara. If accessing your mahara server by the name that you've given it is getting as far as the login page, and you haven't defined any Aliases, then I don't think you need to worry about that part.

BTW, ServerName is the Apache directive for defining the name of a VirtualHost, that's probably why you're confused about not seeing the word VirtualHost.

anonymous profile picture
Account deleted
Posts: 6

21 October 2011, 12:23

Darn...maybe I shouldn't have said Windows in my first post...I read about how to properly submit a forum host and they said something to the effect of include all environmental details, but I only included Windows as the platform I am using to do the install.  But my Mahara install is being hosted by a host provider using Unix presumably.  

Here is my config:

$cfg->dbtype   = 'mysql5';

$cfg->dbhost   = 'localhost';

$cfg->dbport   = null;

$cfg->dbname   = 'USERNAME_mahara';

$cfg->dbuser   = 'USERNAME_mahara';

$cfg->dbpass   = '<I blanked this out>';

$cfg->log_environ_targets = 0;

$cfg->wwwroot = '';

$cfg->dataroot = '/home/USERNAME/maharadata';

I have changed my college's name to "myschool" in my posts and my actual username to USERNAME...just because my install isn't working yet and I don't want to advertize until it is all running properly.  

Also, the directory maharadata has 777 as its permissions setting.

Thank you so much.

anonymous profile picture
Account deleted
Posts: 29

22 October 2011, 12:33

Hi Williams,

Just went over this conversation and there was something about the conversation that I had to keep watch. It was because I had the same issue! There are two issues you will need to watch Williams. This first is the location of the Mahara installation, and the second is the < config.php >.

I have noticed that some installations of Mahara do a double install, so essentially when an end-user signs-in, the end-user is signed-in, but when the end-user clicks on Site Administration, the end-user is asked again to sign-in. This means there is a double installation of the Mahara package.

The installation wants to install everything into the < /mahara/htdocs/ > directory. The problem is that the < config.php > doesn’t point to the < /mahara/htdocs/ > directory for Mahara, rather a straight forward URL location. The first step is half way done!

In the < config.php > comment out this line:

< $cfg->wwwroot = ''; > like so: < // $cfg->wwwroot = ''; >

This will be the URL of the Mahara installation. Notice that it’s not pointing to the < /mahara/htdocs/ > directory. I actually changed the line to: < $cfg->wwwroot = ''; > 

My line looks like this:

$cfg->wwwroot = '';

. !!!Only comment out the original line and document in the comment block why. Do not delete it!!!

Next we’ll need to take notice of where the Mahara installation has taken place. If the original installation had stalled or failed, and the end-user attempted to reprocess the installation to the same directory, there will be two (2) installations of Mahara in the same directory.


From the conversation, it doesn’t appear that you have used Mahara.

  1. Delete the installation including going into CPANEL and delete the folder, and any aliases (sub domains pointing to the failed installation.)
  2. Make a new directory
  3. Reinstall the installation to that directory (keeping note of the installation URL.)
  4. Sign-in to the new Mahara, change the administrator password.
  5. Sign-out, and then sign-in.
  6. Create your account as an administrator.
  7. Sign-out.
  8. Manually run the < cron.php > from the web browser by navigating to the absolute URL (< > if I remember correctly.)
  9. Sign-in > Site Administration, it should show "CRON is running normally."
  10. Go to CPANEL >t he mahara installation folder > open < config.php > in an editor, and comment out the line: < $cfg->wwwroot = ''; >
  11. Copy the commented line, remove the comment tags, and change the URL to point to the < / mahara/htdocs / > like so: < http:// >.


I personally got rid of the < mahara/htdocs/ > directory by copying everything out of the

< mahara/htdocs/ > and placing it into the base directory.

Thank you.


anonymous profile picture
Account deleted
Posts: 6

26 October 2011, 17:05

Thank you very much for the detailed reply.

I wanted to report back that I believe your assessment of my issue was correct.  When I went into the File Manager today, there were a few folders named mahara that I didn't remember creating and so I deleted all of them and started my install fresh all over again.

I now have a functioning install of Mahara and I am not being asked to log in with every click to a new page.

Thanks again!

anonymous profile picture
Account deleted
Posts: 29

26 October 2011, 22:09

Hi Williams,

Outstanding...good job!

Thank you.

11 results