Setting your workpath (alias) on LAMPP


Hosting files outside the htdocs directory

The document root (web root) directory is located at /opt/lampp/htdocs/. All files placed in this directory will be processed by the web server.

To host other files on your system with XAMPP, you can configure an alias with apache.

  1. Edit apache’s httpd.conf with your favorite editor.
    nano /opt/lampp/etc/httpd.conf
  2. Find “DocumentRoot“, you will see something like:
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">


In the next line after “</Directory>” paste this:

<Directory "/yourDirectory/">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted

Next find the “<IfModule alias_module>”:

<IfModule alias_module>

    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo

And before the “</IfModule>” paste this:

Alias /yourAlias /yourDirectory/

Now do not forget to restart Apache:

# /opt/lampp/lampp restart

This will allow you to host files from your home directory (or any other directory) with XAMPP.

In the above example, you can access the files by pointing your web browser to localhost/yourAlias.

Debugging and profiling with Xdebug and Xampp

For detailed instructions go here.

You must first download the Xampp Development Tools from the same download page here.

Extract this into your Xampp directory:

# tar xvfz xampp-linux-devel-x.x.x.tar.gz -C /opt

You should be able to successfully run


in your xdebug folder.

PhpMyAdmin 403 Access Forbidden

If your http://localhost/phpmyadmin returns “403 Access Forbidden”, you need to edit the following settings in /opt/lampp/etc/extra/httpd-xampp.conf:

<Directory "/opt/lampp/phpmyadmin">
	AllowOverride AuthConfig Limit
	#Order allow,deny
	#Allow from all
	Require all granted

Local test server security

Apache and MySQL can be configured so that they only listen to requests from your own computer. For most test systems this is fine and it greatly reduces the risk because the services are not reachable from the Internet.

Before you start XAMPP for the first time find and edit these files:

For Apache edit the files xampp\apache\conf\httpd.conf and xampp\apache\conf\extra\httpd-ssl.conf. Look for lines starting with “Listen” such as

Listen 80

and replace them with


For MySQL open the file xampp\mysql\bin\my.cnf find the section “[mysqld]” and add this line


After starting the services, verify the result by going to a command window and start and execute:

netstat -a -n

For the entries marked as LISTEN in the last column, look at the Listen column. It should always start with or ::1 but not with

3 thoughts on “Setting your workpath (alias) on LAMPP”

  1. Excellent post! just what I wanted =)

    I wanted to have my wordpress installation ~/Documents/ while lampp was installed in /opt/lampp/

    In the above case, to get ftp working to install themes/plugins do the following:
    1. Open the ftp config file
    sudo gedit /opt/lampp/etc/proftpd.conf

    2. Comment the DefaultRoot directive and add this (with a tilde)
    DefaultRoot ~

    3. Save and reload the ftp server:
    sudo /opt/lampp/xampp reloadftp

    4. When you are installing a theme/plugin from wordpress backend, use the following ftp details:

    host: localhost

    1. edit:

      4. When you are installing a theme/plugin from wordpress backend, use the following ftp details:

      host: localhost
      user: (user account that you’re currently logged-in in ubuntu)
      pass: (password for the same)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s