How to Install XAMPP 1.8.1 on Linux

XAMPP LinuxNOTE TO READERS: This blog is only relevant for versions of XAMPP prior to 1.8.3.  Since the release of XAMPP 1.8.3, Apache Friends has synced up all the capabilities for Linux, Mac OS and Windows versions and fixed the problems addressed in this blog. Now you just load with the installer script and everything works right out of the box. 

In my last XAMPP article I described a step by step procedure for installing XAMPP on the Mac OS X. This time around I’ll walk you through the process of installing and configuring XAMPP 1.8.1 on Linux.

Linux Installation Procedure

The installation procedure here is based on CentOS 6.x workstation default installation. This distro and installation lack many of the libraries you need so it requires more work to get XAMPP running than on other distros like Ubuntu.

  1. The default installation of CentOS lacks some of the libraries that XAMPP needs to run, including 32 bit compatibility libraries.  To get them you su to root then use this yum command
    yum -y install glibc* libstd* ld-linux.so.2
  2. Download and install the latest verions from the XAMPP – 1.8.1 as of this writing – from the XAMPP download page.
  3. Unpack the tarball.
    tar zxvf xampp-linux-1.8.1.tar.gz
  4. Move the xampp package to /opt
    mv ./lampp /opt/
  5. XAMPP was designed to run on 32 bit operating systems. The start up script will prevent xampp from starting up if you are running on a 64 bit system which isn’t necessary since you installed 32 bit compatibility libraries in step 1. To get around this restriction, open /opt/lampp/lampp in an editor and comment out the following lines.
    # XAMPP is currently 32 bit only
    #case `uname -m` in
    # *_64)
    #   if /opt/lampp/bin/php -v > /dev/null 2>&1
    #   then
    #      :
    #   else
    #      $de && echo "XAMPP gibt es zur Zeit nur als 32-Bit Applikation.
    #      Bitte verwende eine 32-Bit Kompatibilitaetsbibliothek fuer Dein
    #      System."
    #
    #      $de || echo "XAMPP is currently only availably as 32 bit
    #      application. Please use a 32 bit compatibility library for
    #      your system."
    #
    #   exit
    #   fi
    #   ;;
    #esac
  1. Open /opt/lampp/etc/etc/extra/httpd-xampp.conf in an editor.
  2. Replace the “Deny from all” statement with “Require all grant” in the <LocationMatch> stanza.  You can also comment out the “Allow from…” line if you don’t want to accept connections from any external system.
    <LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|
                                   server-status|server-info))">
        Order deny, allow
    #   Deny from all
        Require all granted
    #   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>
  3. Start up xampp
    /opt/lampp/lampp start
  4. Open http://localhost in a browser. You should a get a browser window with the XAMPP for Linux startup screen:

  1. At this point most of the setup work for XAMPP is done.  However, if you plan to use phpyMyAdmin you’ll have to do a little further configuration to get it to work properly.
  2. XAMPP does not create all the tables that phpmyadmin needs so you have to do this with an SQL script that is enclosed with the package. To do this click on the Import tab in the toobar at the top of the screen.
  3. Click on the Choose button in the File to import section. The button in your version of phpMyAdmin might say Browse.

  1. Choose the create_tables.sql script in /opt/lampp/lampp/phpmyadmin/examples directory.

  1. Click on the Go button in the Format of imported file to run the script which will add all the tables you need to the phpmyadmin database.
  2. Open /opt/lampp/lampp/phpmyadmin/config.inc.php in your editor of choice.
  3. If you want the default language of phpMyAdmin to be English, add these two lines:
    $cfg['DefaultLang'] = 'en-utf-8'; // Language if no other language is recognized
    $cfg['Lang'] = 'en-utf-8';        // Force this language for all users
  4. Change the authentication type as follows:
    $cfg['Servers'][$i]['auth_type'] = 'cookie'
  5. Add the following lines in the config.inc.php file.
    $cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';
    $cfg['Servers'][$i]['recent'] = 'pma_recent';
  6. To set a root password for phpmyadmin click on the Users tab in the XAMPP Control Panel toolbar.

  1. Click on the edit icon in the column to the right on the User Overview table for the root account on localhost.

  1. Click on the Password radio button in the Change password section of the Edit Privileges: User ‘root’@’localhost’ page.

  1. Enter the new password then re-type the password.
  2. Click on the Go button to save the new password.
  3. Repeat steps 21 – 24 for root account on linux.
  4. Close your browser then restart Apache and MySQL in the XAMPP Control Panel.
    /opt/lampp/lampp restart
  5. Open phpMyAdmin in your browser.  This time you’ll be take to a phpMyAdmin login screen.
  6. Login as root using password you set in step 21.

If everything went well you’ll go to the phpMyAdmin main screen and see a green Exit icon under the phpMyAdmin frame on the left side of the screen.  You can now create other databases and tables with phpMyAdmin.

Author:


5 Comments

Tanzeem on April 9, 2013 at 2:55 am.

I get the following error after successfully starting Xampp and typing http://localhost in my Firefox browser. I am using 64 bit CPU running Fedora 17.

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500
localhost
Tue 09 Apr 2013 03:21:31 PM IST
Apache/2.2.11 (Unix) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.2.9 mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0

Reply

vic on April 9, 2013 at 1:36 pm.

Here is a link to an article that you might find helpful: http://www.lancelhoff.com/xampp-500-internal-server-error/.

Reply

Bina on January 1, 2014 at 9:05 pm.

This article is very helpful, however I am trying to make my default page to load from a different folder i.e. /var/www/html instead of the current default page that is uploaded from /opt/lampp, but I would like to keep MySQL and MyPHPAdmin as they are.

I would greatly appreciate if you could give any guidance on how this could be done.

Thanks,
Bina.

Reply

vic on January 5, 2014 at 10:43 am.

You’ll can set the DocumentRoot in /opt/lampp/etc/http.conf to /var/www/html. After doing that, restart lamp.

Reply

Leave Your Comment

Your email will not be published or shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>