LAMPP or XAMPP – How to

Since we started our database courses (last semester), the teacher introduced us to XAMPP or LAMPP (if on linux) – it is an Apache distribution that contains MySQL, PHP, Perl and an FTP server (proftpd). It’s intended to be easy to install and use and it’s good for developers. 

Even though it is intended to be simple to install and use, you still can stumble into problems sometimes. I fixed those problems first time i used but now i have to fix them again because i’ve reinstalled my OS and there are some stuff that i didn’t not.

This will be an article on how to install, use, fix different problems and others. It is made for Linux (i’m using Ubuntu 12.04) and a Windows thing will probably follow but i don’t know when. Basically, i’m doing this for me, so i won’t have to google any little problem everytime i get it when i install XAMPP, but if it proves to be useful for others, that’s perfect.

Install

  1. Download the latest version from the official site.
  2. Login as root user ( su ) and extract to /opt :
    1. tar xvfz xampp-linux-X.X.X.tar.gz -C /opt – (chane the Xs with the current version)
  3. Start it :
    1. /opt/lampp/lampp start
  4. Browse to localhost.

Unninstall

To unninstall it you just have to delete the files :

rm -rf /opt/lampp

Usage

1. Change first page. You have to edit the index.php file, or just make a new one and rename the old one to something else.

gedit /opt/lampp/htdocs/index.php

Or

mv /opt/lampp/htdocs/index.php /opt/lampp/htdocs/old.index.php && gedit /opt/lampp/htdocs/index.php

2. Install CMSs (content management systems – like wordpress, drupal and so on). Just get your CMS files (usually a tarball or an archieve that you will untar / unrar  to /opt/lampp/htdocs/NEW_CMS )

Example for WordPress. Get your latest release from the official website – here. Untar the tarball to /opt/lampp/htdocs/wordpress.

tar xvfz wordpress-3.4.2.tar.gz -C /opt/lampp/htdocs/

Next, browse to localhost/wordpress and here’s your wordpress blog.

Common problems

1. Can’t access PHPMyAdmin

As it can be seen in the screenshot, you have to edit the httpd-xampp.conf:

gedit /opt/lampp/etc/extra/httpd-xampp.conf

Look for the following chuncks of the config file:

Original

<Directory “/opt/lampp/phpmyadmin”>
    AllowOverride AuthConfig Limit
    Order allow,deny
    Allow from all
</Directory>

<LocationMatch “^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))”>
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8
        fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
        fe80::/10 169.254.0.0/16

    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

And edit them as below:

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

<LocationMatch “^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))”>
    Order deny,allow
    Allow from all
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

2. My PHP version is outdated, how do i update?

First, you should backup your phpmyadmin config file, so that you won’t screw something up if the update won’t go as it should.

cp /opt/lampp/phpmyadmin/config.inc.php /root/config.inc.php.backup

Next, you simply delete phpmyadmin.

rm -rf /opt/lampp/phpmyadmin/*

Now, download the latest version of phpmyadmin from the official site. If you don’t know which, the english.tar.gz should do. Untar the packae to the right path:

tar xvfz phpMyAdmin-3.5.3-english.tar.gz -C /opt/lampp/

You probably ended up with 2 phpmyadmin folders – the original one and the new one. Move the contents from the new one to the original one.

mv /opt/lampp/phpMyAdmin-3.5.3-english /opt/lampp/phpmyadmin

copy the backup of config.inc.php back to its place

in case of error:
login as root
c) chown -hR root /opt/lampp (Change the path as required)
d) chmod -R 777 /opt/lampp
e) /opt/lampp/lampp restart
chmod 705 /opt/lampp/phpmyadmin/config.inc.php

References