Sie sind auf Seite 1von 26

1

Installing Elgg
Before you begin, make sure you have read Elgg's technical requirements. If you discover problems
after following these instructions, check out the troubleshootingpage.

1. Upload Elgg

Download the latest version of Elgg. Unzip Elgg and upload it to your webserver.

 If you want Elgg in your root domain (e.g. http://example.com), move or upload the contents of
the unzipped Elgg folder into the document root directory of your server.
 If you want Elgg in its own subdirectory on your website (e.g.http://example.com/elgg),
rename your unzipped directory to the name you would like the subdirectory to have and upload
the directory to your document root.

2. Create a data folder

Elgg needs a special folder to store uploaded files, including profile icons and photos. You will need to
create this directory.

We recommend that this folder is called data. For security reasons this must be stored outside of your
document root. For example, if Elgg is installed in /home/elgg/html/, you might create it
in /home/elgg/data. Alternately, if Elgg is installed/home/username/public_html/, then you may want
to create it in/home/username/elgg/.

Once this folder has been created, you'll need to make sure the web server Elgg is running on has
permission to write to it and create directories in it. This shouldn't be a problem on Windows-based
servers, but if your server runs Linux or a UNIX variant, you'll need to type something like:

chgrp www-data /home/elgg/data/

chmod 775 /home/elgg/data/

If you use a graphical client to upload files, you can usually set permissions by right or shift-clicking on the
folder and selecting 'properties' or 'Get Info'.

NOTE: Setting your data directory to 777 will work, but it is insecure and so not recommended. If you are
unsure how to correctly set permissions, contact your host for more information. Again, you need to make
sure your web server has full permissions to the directory.

3. Create a database

www.almuhibbin.com
2

Using your database administration tool of choice (if you're unsure about this, ask your system
administrator), create a new database for Elgg. Add a user to the database with all privileges. Make sure
you know the database name, username and password necessary to access this as you will be prompted
to add this information in the installer.

 Create a database with cPanel

Create a database with cPanel


cPanel is a widely used graphical administration tool for websites that provides a wizard for creating
MySQL databases.

To make a database using the cPanel MySQL Database Wizard:

1. Log in to your cPanel


2. Click on the MySQL Database Wizard icon.
3. Create a name for the database (e.g. elgg)
4. Create a username (e.g. elgg)
5. Type in a password twice or have the wizard create one
6. Click the All Privileges checkbox

You will be prompted for the database name, the username, and password when you install Elgg. With
cPanel, the database and user names must be proceeded by the cPanel username and an underscore.
For example:

 Database: cpanelloginname_databasename
 Username: cpanelloginname_username

 Create a database with phpMyAdmin

Create a database with phpMyAdmin


phpMyAdmin is a popular web-based front end for MySQL Administration. To create a new database,
follow these instructions:

1. Log in to phpMyAdmin
2. Create the database
3. Select your database on the sidebar menu
4. Go to the Priviledges tab and click Add a new user

www.almuhibbin.com
3

5. Fill out the top 4 fields, setting Host to localhost and then click Go

The database name, username, and password set here are used in the first install screen of Elgg.

 Create a database with mysql client

Create a database with mysql client


To follow these instructions, you must know the root password for the database. This is likely different
from the root password of the server.

1. Start mysql client: mysql -u root -p


2. Create database: CREATE DATABASE mydatabasename;
3. Create user: CREATE USER myuser IDENTIFIED BY PASSWORD 'mypassword';
4. Give user permissions to the database: GRANT ALL ON mydatabasename.* to myuser;

4. Visit your Elgg site

Once you've performed these steps, visit your Elgg site in your web browser. Elgg will take you through
the rest of the installation process from there. The first account that you create at the end of the
installation process will be an administrator account.

A note on settings.php and .htaccess

The Elgg installer will try and create two files for you:

 engine/settings.php, which contains the database settings for your installation


 .htaccess, which allows Elgg to generate dynamic URLs

If these files can't be automatically generated, for example because the web server doesn't have write
permissions in the directories, Elgg will tell you how to create them. You could also temporarily change
the permissions on the root directory and the engine directory. Set the permissions on those two
directories so that the web server can write those two files, complete the install process, and them
change the permissions back to their original settings. If, for some reason, this won't work, you will need
to:

www.almuhibbin.com
4

 Copy engine/settings.example.php to engine/settings.php, open it up in a text editor and fill in


your database details
 Copy /htaccess_dist to /.htaccess

Note for installation on a virtual host (e.g. Rackspace, Amazon EC2)

For installation to proceed successfully, modify the .htaccess file in the root, and uncomment out:
117: #RewriteBase /

To be:
117: RewriteBase /

Operating System Specific Instructions

 Windows EasyPHP
 Windows XAMPP
 Mac OSX MAMP
 Ubuntu Linux

Install Ubuntu

1. Install Apache webserver: sudo apt-get install apache2


2. Install MySQL database server: sudo apt-get install mysql-server
3. Install PHP: sudo apt-get install php5 libapache2-mod-php5 php5-mysql
4. Install phpmyadmin: sudo apt-get install phpmyadmin
5. Turn on the Apache module rewrite: sudo a2enmod rewrite
6. Edit /etc/apache2/available_sites/default to allow URL rewrites
7. Restart Apache: sudo /etc/init.d/apache2 restart

www.almuhibbin.com
5

Install Troubleshooting
Help! I'm having trouble installing Elgg

You'll want to first recheck that your server meets the technical requirements for Elgg. Are you sure that
your server is not configured to run in cgi mode or safe mode? Have you verified that mod_rewrite is
being loaded? Is the mysql apache being loaded?

Keep notes on steps that you take to fix the install. Sometimes changing some setting or file to try to fix a
problem may cause some other problem later on. If you need to start over, just delete all the files, drop
your database, and begin again.

I can't save my settings on installation (I get a 404 error when saving settings)

Elgg relies on the mod_rewrite Apache extension in order to simulate certain URLs. For example,
whenever you perform an action in Elgg, or when you visit a user's profile, the URL is translated by the
server into something Elgg understands internally. This is done using rules defined in an .htaccess file,
which is Apache's standard way of defining extra configuration for a site.

This error suggests that the mod_rewrite rules aren't being picked up correctly. This may be for several
reasons. If you're not comfortable implementing the solutions provided below, we strongly recommend
that you contact your system administrator or technical support and forward this page to them.

Instructions for testing mod_rewrite

mod_rewrite isn't installed.

Check your httpd.conf to make sure that this module is being loaded by Apache. You may have to
restart Apache to get it to pick up any changes in configuration. You can also use PHP info to check to
see if the module is being loaded.

The rules in .htaccess aren't being obeyed.

In your virtual host configuration settings (which may be contained withinhttpd.conf), change the
AllowOverride setting so that it reads:

AllowOverride all

This will tell Apache to pick up the mod_rewrite rules from .htaccess.

www.almuhibbin.com
6

You installed Elgg in a subdirectory

See the item below about installing in a subdirectory of your html root.

The install script redirects me to "action" when it should be "actions"

This is a problem with your mod_rewrite setup (see previous troubleshooting item).

DO NOT, REPEAT, DO NOT change any directory names!

I installed in a subdirectory and my install action isn't working!

If you're getting errors on installation like:


Not Found. The requested URL /elgg/action/systemsettings/install was not found on this server

Notice that the requested URL begins with elgg. That means you installed Elgg in a subdirectory rather
than your site's html document root. You may need to give mod_rewrite a pointer to where your Elgg
installation is.

 Open up .htaccess in a text editor

 Where prompted, add a line like RewriteBase /path/to/your/elgg/installation/ (Don't


forget the trailing slash)
 Save the file and refresh your browser.

Please note that the path you are using is the web path, minus the host.

For example, if your Elgg install is in:

/var/www/html/elgg/

and you view the site by going to http://example.com/elgg/.

Your RewriteBase line should look like:

RewriteBase /elgg/

I did everything! mod_rewrite is working fine, but still the 404 error

Maybe there is a problem with the file .htaccess. Sometimes the elgg install routine is unable to create
one and unable to tell you that. If you are on this point and tried evrything thats written above:

www.almuhibbin.com
7

 check if it is really the elgg-created .htaccess (not only a dummy provided from the server
provider)

 if it is a dummy, use the htaccess_dist (rename it to .htaccess)and edit it in a texteditor, you'll find
the entryRewriteBase commented out with an "#"

 delete the "#" and add your path (i.e.:RewriteBase /path/to/your/elgg/installation/ Don't
forget the trailing slash)

There is a white page after I submit my database settings

Check that the Apache mysql module is installed and is being loaded.

I'm getting a 404 error with a really long url

If you see a 404 error during the install or on the creation of the first user with a url
like:http://example.com/homepages/26/d147515119/htdocs/elgg/action/register that means
your site url is incorrect in your sites_entity table in your database. This was set by you on the second
page of the install. Elgg tries to guess the correct value but has difficulty with shared hosting sites. Use
phpMyAdmin to edit this value to the correct base url.

I am having trouble setting my data path

This is highly server specific so it is difficult to give specific advice. If you have created a directory for
uploading data, make sure your http server can access it. The easiest way to do this is give it permissions
777.

Make sure the path is correct and ends with a /. You can check the path in your database in the datalists
table.

If you only have ftp access to your server and created a directory but do not know the path of it, you might
be able to figure it out from the www file path set in your datalists database table. Asking for help from
your hosting help team is recommended at this stage.

If your server uses PHP in the deprecated safe mode, you may need to add the data directory to the
open_basedir restrictions. Ask your host for more information.

www.almuhibbin.com
8

I am having problems running on MAMP

On certain versions of MAMP, Elgg will either fail to install or have intermittent problems while running.

This is a known issue with MAMP and is related to the Zend Optimizer. Until Zend/MAMP have resolved
this issue it is recommended that you turn off the Zend Optimizer in your PHP settings.

I can't validate my admin account because I don't have an email server!

While it's true that normal accounts (aside from those created from the admin panel) require their email
address to be authenticated before they can log in, the admin account does not.

Once you have registered your first account you will be able to log in using the credentials you have
provided!

I'm installing over an existing Elgg classic install and am getting all kinds of errors (e.g.
500 Internal server error)

Don't!

Elgg 1.0 is an entirely new codebase and data model, and is not backwards compatible with Elgg Classic!
Additionally, it has different installation requirements.

You must install Elgg 1.0 to a new database, and in a different directory on your server.

We will be providing a way of migrating between 0.92 and 1.0 in due course.

Installation breaks with "Parse error: syntax error, unexpected T_NEW"

Elgg is not running under PHP 5.

Remember, PHP has three components - the php module, php cli and php cgi. Running php -v on the
console and getting 5.x.x back does not necessarily mean that the apache module is running PHP 5!

Confirm you have PHP 5 installed and activated as an apache module.

I have tried all of these suggestions and I still cannot install Elgg

It is possible that during the process of debugging your install you have broken something else. Make
sure that you have confirmed that your server meets Elgg's technical requirements. Test your
mod_rewrite. Then do a clean install (drop your elgg database, delete all the files in your elgg directory,
and start the process again).

www.almuhibbin.com
9

If that fails, you may want to seek the help of the Elgg community by posting at Elgg community site. Be
sure to mention what version of Elgg you are installing, details of your server platform, and any error
messages that you may have received including ones in the error log of your server.

Getting Started
You have installed Elgg on your server and worked through any initial server issues. The question you
may be asking yourself is now what? The answer to that question partly depends on why you installed
Elgg in the first place. Let's assume your evaluating Elgg as the basis of a social networking project.

Focus first on core functionality

While it may be tempting to go to the community site and install every interesting plugin, it is better to
initially stick with the plugins included with the installation package. This will allow you to get a sense of
what the platform is like without any issues possibly introduced by a plugin that's not written well.
Assuming that you have already created your first user (who is automatically an admin), using the toolbar
on top go to Site Administration -> Tools Administration and then enable all plugins. This should give you
a basic set of social networking functionality: blog, social bookmarking, files, internal messaging,
microblogging, notifications, activity feed, message board, user profiles.

Create test users

You have two choices for creating test users with the plain install. You can sign them up by going to the
home page or as an admin, you can create users by using the administrative interface (Administration ->
User Administration). You'll probably want to use a different browser when using a test user since only
one user can be logged in at a time in a browser.

Explore user functionality

Now use your test users to create blogs, add widgets to your profile or dashboard, post to the wire
(microblogging), and create pages (wiki-like page creation). Make sure to investigate the Settings off the
toolbar. This is where a user sets notification settings and configures tools (which will be blank as none of
the default plugins add controls here).

Explore admin functionality

All of the admin controls are found by clicking Administration on the toolbar. You have already used the
administration section to turn on plugins and you may have created some users with it also. Now use it to

www.almuhibbin.com
10

browse the log or play around with modifying the default profile fields. You will also want to go to the
Tools Administration page and look for plugins that have settings. With the riverdashboard plugin, turn its
dashboard override setting to yes and then notice how the dashboard has changed from an individual
page with widgets to a site-wide activity stream.

Extending Elgg

After satisfying yourself on what Elgg can do out of the box, you will want to try out some themes and
plugins. You can find many plugins and themes at the community site. As is normal with this sort of thing,
the quality varies so be sure to notice what sort of comments a plugin is getting.

Plugins

The easiest way to look through the plugins is to sort by the number of downloads (most popular). Plugins
are installed in the mod directory and activated on the Tools Administration page. You can find
instructions on installing and configuring pluginshere. If you run into any difficulty, be sure to check
the Administration FAQ.

Themes

Themes are plugins that override display aspects of Elgg. They should normally be placed at the bottom
of the plugin list so that the theme runs last. There were some significant changes between Elgg 1.2 and
Elgg 1.5 so beware what versions the theme supports. Also, the default theme is built into Elgg and does
not need to be turned off. Whenever you install a theme, you are overriding all or portions of the default.
Be sure to read the instructions on installing a theme.

Configuration/Themes
Changing the Look and Feel of Elgg

The look and feel of Elgg can be easily changed through the use of themes. A theme is a type of plugin
that overrides display aspects of Elgg.

Where to get themes

Themes can be obtained from:

 The Elgg website

www.almuhibbin.com
11

Theme installation

A theme is installed just as all plugins are installed. Simply copy the theme's folder to the "mod" directory
in your Elgg install and then activate it from the Elgg admin panel.

To activate the theme:

 Log in to your Elgg site with your administrator account


 Go to Administration -> Tool Administration
 Find your theme in the list of installed plugins and click on the 'enable' button.

Often you will want the theme to be the last plugin to run. The order of the plugins in the Tool
Administration page determines their loading order; to make the theme run last, click the bottom link.

Building your own theme

 Theme development

Themes
In Elgg, a theme is a plugin. Themes are built and installed just as any other plugin. To begin, it is
advisable to familiarise yourself with Plugins and the Views system.

Create your plugin

Step one is to create your plugin as described in plugin development.

 Create a new directory under mod/


 Create a new start.php
 Create a manifest file describing your theme.

Build your theme

There are two ways you can modify views:

View extension

The first way is to add extra stuff to an existing view via the extend view function from within your
start.php’s initialisation function.

For example, the following start.php will add mytheme/spotlight to the already existing site spotlight:
<?php

www.almuhibbin.com
12

function mytheme_init()

extend_view('page_elements/spotlight','mytheme/spotlight');

register_elgg_event_handler('init','system','mytheme_init');

?>

View overloading

Plugins can have a view hierarchy, any file that exists here will replace any files in the existing core view
hierarchy... so for example, if my plugin has a file:

/mod/myplugin/views/default/page_elements/spotlight.php

it will replace:

/views/default/page_elements/spotlight.php

But crucially, only when the plugin is active.

This gives you total control over the way elgg looks and behaves. It gives you the option to either slightly
modify or totally replace existing views.

More information

Themes for Elgg are both extremely easy to develop and incredibly powerful. Using themes you can
completely change how an Elgg install looks and feels (and even behaves).

Since there has been a fair amount of discussion of themes on the groups, I thought it would be a good
idea to write a brief post about it.

Themes use two key Elgg concepts - namely, the plugin architecture and the views system.

By far the easiest and flexible way to make a theme for Elgg is to build it as a plugin. This makes it easy
to distribute (since they are self contained) and lets you turn the theme on and off from the admin panel
(making the theming process far less invasive!)

What you must first do is create a new plugin directory under /mod (documented here). In a nutshell;
create a directory in the name of your theme, a new start.php and a new manifest.xml.

www.almuhibbin.com
13

Once you’ve done this you then can start modifying views. This can be done either by extension or by
view overriding.

View extension The first way is to add extra stuff to an existing view via the extend view function from
within your start.php’s initialisation function.

For example, the following start.php will add mytheme/spotlight to the already existing site spotlight:
<?php

function mytheme_init()

extend_view('page_elements/spotlight','mytheme/spotlight');

register_elgg_event_handler('init','system','mytheme_init');

?>

View overriding The next method is to override an existing theme, completely replacing it with the one
provided by your plugin.

View files provided by plugins automatically take precedence over views from the core. So all we have to
do to entirely replace the existing spotlight is to create a new spotlight.php in the appropriate hierarchy.

So, if the original view is stored in:


/elgg/views/default/page_elements/spotlight.php

We need to create the file:


/elgg/mod/mytheme/views/default/page_elements/spotlight.php

Now, when we go to the admin panel and activate our theme the spotlight will be replaced by whatever
you put in that file. Simple eh?

You can of course do this with any view.

Using a combination of these methods means you can replace the entire look and feel of a site very
quickly indeed, although I would suggest that you start slowly since many views do some quite
complicated things.

www.almuhibbin.com
14

Upgrading Elgg
Upgrade Instructions

1. Before upgrading, back up your Elgg database and code. Disable non-core plugins.
2. Download the new version of Elgg from elgg.org.
3. Overwrite your existing Elgg files. Any modifications should have been written within plugins, so
that they are not lost on overwriting. If this is not the case, take care to maintain your
modifications.
4. Visit http://your-elgg-site-URL/upgrade.php
5. Copy htaccess_dist to .htaccess, replacing your existing version. If you modified the default
.htaccess, be sure to move your modifications over to the new one.

Other notes

 It is best to try out a new version on a test site before doing an upgrade
 As you turn your plugins and theme back on when the upgrade is finished, be careful to note
problems with those plugins so that you can report them to the plugin authors.

Administration Manual
Elgg Administrator's Manual

This is mostly a skeleton at this point. Anyone interested in helping to build out an Administration Manual,
please join the Elgg Documentation group. Right now we are assembling an outline of what to include
in such a manual.

Installing Extensions

 Installing and configuring plugins

Configuration/Plugins
Extending Elgg

Elgg can be easily extended to add extra functionality, this is accomplished through the use of Plugins.

Where to get plugins

Plugins can be obtained from:

www.almuhibbin.com
15

 Elgg.org
 The Elgg community site

Plugin installation

To install a plugin, unzip the plugin and copy the plugin's main folder to the "mod" directory in your Elgg
installation.

You must then activate the plugin:

 Log in to your Elgg site with your administrator account


 Go to Administration -> Tool Administration
 Find your plugin in the list of installed plugins and click on the 'enable' button.

 Installing a theme

Changing the Look and Feel of Elgg

The look and feel of Elgg can be easily changed through the use of themes. A theme is a type of plugin
that overrides display aspects of Elgg.

Where to get themes

Themes can be obtained from:

 The Elgg website

Theme installation

A theme is installed just as all plugins are installed. Simply copy the theme's folder to the "mod" directory
in your Elgg install and then activate it from the Elgg admin panel.

To activate the theme:

 Log in to your Elgg site with your administrator account


 Go to Administration -> Tool Administration
 Find your theme in the list of installed plugins and click on the 'enable' button.

Often you will want the theme to be the last plugin to run. The order of the plugins in the Tool
Administration page determines their loading order; to make the theme run last, click the bottom link.

www.almuhibbin.com
16

Building your own theme

 Theme development

 Installing a language pack

Configuration/LanguagePacks
Adding Language Support to Elgg

Language packs are available for download at the Elgg community site. There are language packs
for the core and they are usually installed in the languages directory off the elgg root directory. Other
language packs are provided for various plugins. Generally, the authors make it easy to copy those files
into the languages directory of each plugin under the mod directory.

Managing Your Server and Database

 Configuring Cron

Cron
Contents
[hide]

 1 What is cron?
 2 Elgg and cron
 3 How does it work?
 4 Example crontab
 5 Installation
 6 See also

What is cron?

Cron is a program available on Unix-based operating systems that enables users to run commands and
scripts at set intervals or at specific times. A common use of cron is to rotate server logs to prevent them
from becoming too large.

www.almuhibbin.com
17

Elgg and cron

Elgg has a cron handler for executing functionality periodically. This enables the administrator to setup
jobs to be run periodically. Two common examples would be rotating the system log in the database or
doing garbage collection in the database (compacting the database by removing entries that are no
longer required).

Currently, Elgg supports the following hooks:

 reboot - Run on server boot


 hourly - Run every hour
 daily - Run every day
 weekly - Run every week
 monthly - Run every month
 yearly - Run every year

How does it work?

The Elgg cron handler is activated when particular pages are loaded. As an example,
loadinghttp://example.com/pg/cron/hourly/ in a web browser would activate the hourly hook. To
automate this, a cron job is setup to hit those pages at certain times. This is done by setting up a crontab
which is a configuration file that determines when and what cron runs.

The crontab needs to specify a script or command that will hit the Elgg cron pages. Two commonly
available programs for this are GET and wget. You will need to determine the location of one of these on
your server. Your crontab also needs to specify the location of your website.

Note: If you choose the utility "wget", then we suggest that you specify the option "--output-document"
(see manual for wget). For example, under Debian: /usr/bin/wget --output-document=/dev/null. If you don't
do that, files will be created in the home directory of the CRON user. The number of created files will
increase over and over...

Example crontab

# Location of GET

GET='/usr/bin/GET'

www.almuhibbin.com
18

# Location of your site (don't forget the trailing slash!)

ELGG='http://www.example.com/'

# The crontab

@reboot $GET ${ELGG}pg/cron/reboot/

@hourly $GET ${ELGG}pg/cron/hourly/

@daily $GET ${ELGG}pg/cron/daily/

@weekly $GET ${ELGG}pg/cron/weekly/

@monthly $GET ${ELGG}pg/cron/monthly/

@yearly $GET ${ELGG}pg/cron/yearly/

Installation

Take the example and change the ELGG and GET variables according to your server setup. If you have
ssh access to your Linux servers, type crontab -e and enter the crontab details into the text editor that
results. If you already have a crontab setup, you will have to merge the Elgg information into it. If you
don't have ssh access, you will have use a web-based configuration tool to set your crontab. This will vary
depending on hosting provider.

On Windows servers, there are a number of cron emulators available.

For wget, you should try using the flag --spider so that it does not download the file each time. For more
information on wget, see the wget manual.

www.almuhibbin.com
19

 Log rotation

Permission error
You do not have permission to do that, for the following reasons:

 The action you have requested is limited to users in one of the groups user, Sysops.
 Elgg Documentation has restricted the ability to create new pages. You can go back and edit an
existing page, or log in or create an account.

 Garbage collection

Managing Your Website

 Taking your site temporarily offline

Taking your site temporarily offline


To take your site offline, you may wish to download and install the Elgg plugin Maintenace.

 Making your site search engine friendly


 Entering search engine meta-data
 Moving your site

Duplicate Installation
Contents
[hide]

 1 Introduction
o 1.1 Why Duplicate an Elgg Installation?
o 1.2 What Is Not Covered in This
Tutorial
o 1.3 Before You Start
 2 Copy Elgg Code to the Test Server
 3 Copy Data to the Test Server
 4 Edit engine/settings.php
 5 Copy Elgg Database
 6 Database Entries
o 6.1 Change the installation path
o 6.2 Change the data directory
o 6.3 Change the site URL

www.almuhibbin.com
20

o 6.4 Change the filestore data directory


 7 Check .htaccess
 8 Update Webserver Config
 9 Run upgrade.php
 10 Tips

[edit]Introduction

[edit]Why Duplicate an Elgg Installation?

There are many reasons you may want to duplicate an Elgg installation: moving the site to another
server, creating a test or development server, and creating functional backups are the most common. To
create a successful duplicate of an Elgg site, 3 things need to be copied:

 database
 data from the data directory
 code

Also at least 5 pieces of information must be changed from the copied installation:

 engine/settings.php file
 .htaccess file
 database entry for your site entity
 database entry for the installation path
 database entry for the data path

[edit]What Is Not Covered in This Tutorial

This tutorial expects a basic knowledge of Apache, MySQL, and Linux commands. As such, a few things
will not be covered in this tutorial. These include:
* How to backup and restore MySQL databases.

* How to configure Apache to work with Elgg.

* How to transfer files to and from your production server.

[edit]Before You Start

Before you start, make sure the Elgg installation you want to duplicate is fully functional. You will also
need the following items:
* A backup of the live Elgg database.

www.almuhibbin.com
21

* A place to copy the live database.

* A server suitable for installing duplicate Elgg site.

(This can be the same server as your production Elgg installation.)

Backups of the database can be obtained various ways, including phpMyAdmin, the MySQL official GUI,
and the command line. Talk to your host for information on how to backup and restore databases or use
Google to find information on this.

During this tutorial, we will make these assumptions about the production Elgg site:
* The URL is http://www.myelgg.org/

* The installation path is /var/www/elgg/

* The data directory is /var/data/elgg/

* The database host is 'localhost'

* The database name is 'production_elgg'

* The database user is 'db_user'

* The database password is 'db_password'

* The database prefix is 'elgg'

At the end of the tutorial, our test Elgg installation details will be:
* The URL is http://test.myelgg.org/

* The installation path is /var/www/elgg_test/

* The data directory is /var/data/elgg_test/

* The database host is 'localhost'

* The database name is 'test_elgg'

* The database user is 'db_user'

* The database password is 'db_password'

* The database prefix is 'elgg'

[edit]Copy Elgg Code to the Test Server

www.almuhibbin.com
22

The very first step is to duplicate the production Elgg code. In our example, this is as simple as copying
/var/www/elgg/ to /var/www/elgg_test/.

cp -a /var/www/elgg/ /var/www/elgg_test/

[edit]Copy Data to the Test Server

In this example, this is as simple as copying /var/data/elgg/ to /var/data/elgg_test/.

cp -a /var/data/elgg/ /var/data/elgg_test/

If you don't have shell access to your server and have to ftp the data, you may need to change ownership
and permissions on the files.

Note that you also need to delete the views cache on the test server after the copy process. This is a
directory calledviews_simplecache in your data directory and the file called view_paths.

[edit]Edit engine/settings.php

The engine/settings.php file contains the database configuration details. These need to be adjusted for
your new test Elgg installation. In our example, we'll look in /var/www/elgg_test/engine/settings.php and
find the lines that look like this:
// Database username

$CONFIG->dbuser = 'db_user';

// Database password

$CONFIG->dbpass = 'db_password';

// Database name

$CONFIG->dbname = 'elgg_production';

// Database server

// (For most configurations, you can leave this as 'localhost')

$CONFIG->dbhost = 'localhost';

// Database table prefix

www.almuhibbin.com
23

// If you're sharing a database with other applications, you will want to use this

// to differentiate Elgg's tables.

$CONFIG->dbprefix = 'elgg';

We need to change these lines to match our new installation:


// Database username

$CONFIG->dbuser = 'db_user';

// Database password

$CONFIG->dbpass = 'db_password';

// Database name

$CONFIG->dbname = 'elgg_test';

// Database server

// (For most configurations, you can leave this as 'localhost')

$CONFIG->dbhost = 'localhost';

// Database table prefix

// If you're sharing a database with other applications, you will want to use this

// to differentiate Elgg's tables.

$CONFIG->dbprefix = 'elgg';

Notice the $CONFIG->dbname has changed to reflect our new database.

[edit]Copy Elgg Database

Now the database must be copied from 'elgg_production' to 'elgg_test'. See your favorite MySQL
manager's documentation for how to make a duplicate database. You will generally export the current
database tables to a file, create the new database, and then import the tables that you previously
exported.

You have two options on updating the values in the database. You could change the values in the export
file or you could import the file and change the values with database queries. One advantage of modifying

www.almuhibbin.com
24

the dump file is that you can also change links that people have created to content within your site. For
example, if people have bookmarked pages using the bookmark plugin, the bookmarks will point to the
old site unless your update their URLs.

[edit]Database Entries

We must now change 4 entries in the database. This is easily accomplished with 4 simple SQL
commands:
[edit]Change the installation path

UPDATE `elggdatalists` SET `value` = "/var/www/elgg_test/" WHERE `name` = "path";


[edit]Change the data directory

UPDATE `elggdatalists` SET `value` = "/var/data/elgg_test/" WHERE `name` = "dataroot";


[edit]Change the site URL

UPDATE `elggsites_entity` SET `url` = "http://test.myelgg.org/";


[edit]Change the filestore data directory

(Only change the first path here!!)

UPDATE elggmetastrings set string = '/var/data/elgg_test/' WHERE id = (SELECT value_id

from elggmetadata where name_id = (SELECT * FROM (SELECT id FROM elggmetastrings WHERE

string = 'filestore::dir_root') as ms2) LIMIT 1) ;

[edit]Check .htaccess

If you have made changes to .htaccess that modify any paths, make sure you update them in the test
installation.

[edit]Update Webserver Config

For this example, you must edit the Apache config to enable a subdomain with a document root of
/var/www/elgg_test/. If you plan to install into a subdirectory of your document root, this step is
unnecessary.

[edit]Run upgrade.php

To regenerate cached data, make sure to run http://test.myelgg.org/upgrade.php

[edit]Tips

www.almuhibbin.com
25

It is a good idea to keep a test server around to experiment with installing new mods and doing
development work. If you automate restorations to the 'elgg_test' database, changing the $CONFIG
values and adding the follow lines to the end of the elgg_test/engine/settings.php file will allow seamless
re-writing of the MySQL database entries.
$con = mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass);

mysql_select_db($CONFIG->dbname, $con);

$sql = 'UPDATE `elgg_datalists`

SET `value` = "/var/www/test_elgg/"

WHERE `name` = "path"';

mysql_query($sql);

print mysql_error();

$sql = 'UPDATE `elgg_datalists`

SET `value` = "/var/data/test_elgg/"

WHERE `name` = "dataroot"';

mysql_query($sql);

print mysql_error();

$sql = 'UPDATE `elgg_sites_entity`

SET `url` = "http://test.myelgg.org/"';

mysql_query($sql);

print mysql_error();

Managing Users

 Setting user registration policy


 Adding a new user
 Resetting a user password
 Dealing with a problem user

www.almuhibbin.com
26

Managing Content

 Dashboard
 Tools
 Settings
 Administration

Security Guide

Debugging a Site

Development

 Finding a developer

www.almuhibbin.com