Installation - Data Directory

Hi Everybody,

I'm new to elgg and already struggling with the installation. The data directory must be created outside of the document root? If it's outside of the root how can I get the URL for it or does it have to be added to a different domain, I guess it's easy but I just don't understand.




  • Think of the directory as a 2nd database; it's not for public use. Just put the path in like /var/elgg-data or whatever.

  • As Steve said, it's not an url you need to enter during installation for the data directory but the path on the filesystem to the data directory. Enter the absolute, full path starting with the filesystem root down to the data directory you have created and not just a relative path for example from the home directory.

    It must be outside the document root to prevent direct access over the Internet to its content. Elgg deals with serving the files if they are required and deals with access restrictions that might be set on them.

  • Thanks for the help, I can't beleive that I find it so difficult to install. I added a new directory When asked for the Data Directory I entered /media/images and get the error "Your data directory /media/images does not exist.". If I enter /media I get the error "Your data directory /media is not writable by the web server.". CHMOD = 770 (even changed to 777) and the Owner has been changed to the FTP and PHP-User. I think i'm missing one important step?

  • Not sure where you created the directory but I think you did create it within the document root directory which would be wrong. Anything that is accessible by url would be wrong. Within the document root directory (the directory on the server that matches the url only the Elgg install files (from the zip file) are to be saved (and possibly later on additional plugins).

    The data directory must be outside this directory and also not within any subfolder within. As directory structures are different from server to server I can't tell you exactly where to create the directory. A typical setup on a server could be.


    for the document root directory. Then you can create the data directory for example as


    and then enter "/home/username/data/" during installation. The point is: it's not any url but a filesystem path you need to enter. And it must be the full path. It could be that you can't access the folder above the document root folder over ftp. In this case you would have to use for example a filebrowser that might be available via the administration section (e.g. CPanel) on the server. If in doubt, ask the support of your hosting provider.

    Permissions must be set for the webserver process to be able to access/read/write the data directory, i.e. either set the owner and group for the directory accordingly or set it to 777 permissions (which is not a major issue as long as the folder is not within the document root folder but if it would be it would be a major security issue).

    If it still doesn't work, the server might be set up to use the open_basedir directive (set in php config). Again something to ask the support about. If this would be the case, the directory would appear non-existing even if created at the right place with correct permissions. In this case the filepath to the directory would have to be added to the list of allowed directories in the php.ini of the server (you might not be allowed to change that on a shared server though and if this would be the case the hosting plan might not be suitable for Elgg unfortunately - just ask the support about it).

  • It is not that complicated. Just install the elgg in your public_html folder in a subfolder. Like public_html/elgg.

    And then, go to url like and then you will be asked for directory of your website. You will be required to enter directory like home/username/public_html/elgg. It may differ from server to server.

    If you see any error, give 777 permisson to your folder which is shown as error during installation.

  • What @rahul wrote is at least misleading if not wrong!

    Just DO NOT create the data directory within public_html (or www or whatever your document root folder is named). Even if you install Elgg in a subfolder within the document root directory DO NOT create the data directory within the document root folder.

    The important point is that anything within the document root folder is directly accessible from the Internet. This isn't a problem for the Elgg install files as they don't require write access and need to be (read) accessible anyway.

    But the content of the data directory needs to be writable for the webserver (and as such could also be modified over the Internet). So, DO NOT create the data directory within document root.

    If you have trouble with creating the data directory, ask the support of your webhost. The must be able to help you easily - even if it's only to tell you that you can't create a folder / save stuff outside the document root folder as it might be the case on some free hosting servers. But the whole server setup can vary so much that it's simply impossible to tell you the exact path where to create the data directory and what correspondingly needs to be entered at installing Elgg. I can only suggest: if your webspace has a home directory (one level above the document root folder), create the data directory within. If you have CPanel or a similar administration tool it should have a file browser to handle it. And if still in doubt, as the support guys of your webhoster.

  • @iionly

    i installed elgg in that way. Do i need to change something ?

    how can i change or rectify it ?

  • @rahul Move the directory outside the document root and replace it with a symlink. This can be done in one quick operation with no downtime. Then change the dataroot in advanced settings to point to the new location, and delete the symlink.