Introduction
In the previous post I wrote a short introduction to Elgg, an open source social network engine. Elgg is initially meant for installing in a LAMP environment, but it is also possible to install it in Windows, although this is not recommended for production servers. In this post I’ll explain how to install a web server with Elgg in Windows.
Requirements
Elgg requires an Apache web server with the mod_rewrite plugin and PHP5 installed, and a MySql database. The PHP also must have a few libraries (GD, JSON, XML and Multibyte String support). The easiest way to install all this at once in windows is to use one of the existent software packages, like EasyPHP or Xampp.
It had been a few years since the last time I installed Xampp, and the official Elgg documentation already includes some basic instructions for installing EasyPHP, so in this tutorial we’ll use Xampp. The first step is obviously downloading the latest versions of Xampp and Elgg.
Installing Xampp
There are two Xampp versions, as an exe file or as a zip. For the sake of simplicity we’ll install the executable version. Launching it we’ll see this:

After selecting the path were we want to install the software (a new subdirectory “xampp” will be created), we can start the installation. When all files are copied we will be asked a few questions in order to configure the system. The easiest thing is to leave all the default values, that should be the best for most people.
Once that’s finished, we’ll start the Xampp Control Panel:

Start the Apache server and MySql and “voilà”, we have a web server and database running in our system. Once both are started we can access to the Admin pages of Xampp and MySql. I’d recomend you to enter right now in the Apache Admin and make a couple of recommended security changes explained in the “Security” section.

Configuring Xampp for Elgg
To make sure that Elgg works well we’ll have to modify the PHP configuration. Edit the “path_to_xampp/php/php.ini” and look for this line: “;extension=php_curl.dll”. Delete the “;” and save the file.
After that, uncompress the zip that contains the Elgg code in the directory we want. Now we have to tell Apache where the code is, and for that we’ll open the file “…/xampp/apache/conf/httpd.conf” with the editor.
We have two options for the configuration: install Elgg at the root of our web server (so we would access it directly with http://localhost/) or installing it in a subdirectory (for example http://localhost/elgg/). In this tutorial I’ll explain the second option.
Elgg in a subdirectory
In the httpd.conf file we look for the following line: (the xxx depends on where you installed xampp):
DocumentRoot "xxx/xampp/htdocs"
Under this line we add:
Alias /elgg/ "path_to_elgg_directory/"
Where i wrote “elgg” you can put whatever you want, and you will be able to access your Elgg installation via “http://localhost/what_you_wrote/”.
Once that line is added, look for the following:
<Directory "xxx/xampp/htdocs/">
...
</Directory>
Under that you should add (it’s important that the path ends with “/”):
<Directory "path_to_elgg_directory/">
Options FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Later we’ll have to make a small change in one of Elgg files in order to tell it in which address it is installed. I’ll tell you later about that.
Database configuration
After the last step, you should be able to see the first Elgg configuration page in your browser at the url http://localhost/elgg/ (or whatever address you chose):

In this page we have to write the credentials for our MySql database, and Elgg will configure it. For this we have to create a MySql user and a new repository, and for that we’ll use the configuration tool included with Xampp. You can access it in your browser (http://localhost/phpmyadmin/ ) or clicking the MySql Admin button in the Xampp Control Panel. We’ll see this:

After writing the name of the database we want, click “Create” and we’ll have our new empty MySql repository. Next we have to create our new database user for Elgg (it is recommended not to use the “root” user for Elgg). In the “Privileges” tab, select the option for adding a new user and fill out the data.

Now we have to give our user the privileges for using the repository we created. Search for the box “Database specific privileges”, write the name of the repository and press “Go”. We’ll access a form where we can select the privileges for our user. The easiest is just pressing “Check All” and again “Go” and we’ll have our user and repository ready.

Now we just have to give Elgg the database parameters. Go back to the Elgg page and fill out the form.
Configurando Elgg
Once we have saved the previous form, we’ll see another Elgg configuration page:

Wait a moment before starting writing, first we have to make the small change I told you about before, or Elgg will not be able to recognize where it is installed in the web server. We edit the file “path_to_elgg/.htaccess” and look for the line:
#RewriteBase /
Change the line to (write the same you wrote in the Alias in the httpd.conf file before):
RewriteBase /elgg/
Now we can write the configuration data for our Elgg installation. Be sure to put the right values for your installation and save it. Ah, I forgot, you should have created a directory to store the temporary and user files for Elgg (”C:/Work/elgg/data/” in the example), and this directory should be outside the directory where you put the Elgg files (in my case “C:/Work/elgg/www/”).
If everything goes right, next we will see the form for creating our first Elgg administration user. Once done this, you’ll finally see the Elgg welcome page.

I hope this guide has been useful for you. You can find more information about the installation and troubleshooting in the Elgg official documentation, and in case you have any doubts write me a comment and I’ll try to answer it.













