Time for action — creating the config.php file
Now, you have to hold Mahara's hand by letting it know how it can access the database and how to find the dataroot. To do this, you use an important file called config.php:
1. In the
htdocs
folder of your Mahara site, you will find a file calledconfig-dist.php
. Use the nano command in your terminal to start editing theconfig-dist.php
file:nano config-dist.php
Note
Other Linux people use much more sophisticated text editors such as Vim (http://www.vim.org/) and emacs (http://www.gnu.org/software/emacs/). We are simple folk and are perfectly happy with nano — http://www.nano-editor.org/.
2. Now, you will see the file open on the command line. Use the down arrow key on your keyboard to scroll down the page until you get to a section called database connection details. In the following example, the user is using MySQL5 rather than postgreSQL. Fill in the information so that it matches the details you used to set up your own database including your own database name (
dbname
), database user (dbuser
), and database password (dbpass
):3. Next, continue scrolling down the file until you reach a line that starts with $cfg->dataroot. Here, you must fill in the full path from the server root directory to the data directory that you created earlier in this chapter.
4. Now, have a look further down the file, you should see an option to add an e-mail contact. This e-mail address gets displayed if a form is suspected of being spam as a place of contact for those who stumble upon this. Fill in a relevant e-mail address.
5. Finally, you should add a password salt to your
config
file. This is a text string that helps to make user authentication more secure. Add a line similar to the following, but containing your own secret phrase:$cfg->passwordsaltmain= 'your secret phrase here';
6. Congratulations, you've now finished editing the configuration file. Save it by pressing Ctrl + X on your keyboard (still within the nano editor). When asked, if you would like to rename the file, type Y for yes and name the file
config.php
. This will also save the file.
What just happened?
What you just did was very important. You let Mahara know where the database is and the user and password needed to access it. You also let it know the location of the dataroot
directory as well as set a password salt.