Install Xampp on Ubuntu 11.04

XAMPP is a web server that is used to develop applications in PHP, with connection to a SQL database (LAMPP = Linux + Apache + MySQL + PHP + Perl)

 

Installing an Apache web server is not easy for newcomers and is even more complicated if it is required to add MySQL, PHP and Perl.

 

XAMPP is an easy to install and use Apache distribution that contains MySQL, PHP and Perl. It’s really simple to install and use, but keep in mind that it is not intended for use in production (explained at the bottom of the article).

 

It is also a multiplatform GNU project, currently distribute for: Linux, Windows, Mac OS X and Solaris.

 

Official Website: http://www.apachefriends.org/en/xampp.html

 

 

INSTALLING XAMPP

 

– Download the last version of XAMPP from the web. The web page detects the OS and architecture (32 or 64 bits). At present the package to the latest version is: xampp-linux-1.7.4.tar.gz

 

– Once it is downloaded, unzip it to the /opt directory from a terminal with the following command:

sudo tar xvfz xampp-linux-1.7.4.tar.gz-C /opt

 

Note: Make sure that the file name matches the one you downloaded.

XAMPP is already installed in /opt/lampp

 

Note: Tested on Ubuntu 11.04 and 10.10 (32bit and 64bit) with no problems.

 

To uninstall:

sudo rm-rf /opt/lampp

 

Set permissions to the /opt/lampp/htdocs

(This is where web pages files are stored)

 

1. Grant write permissions to /opt/htdocs by issuing the following command:

sudo chmod a + w /opt/lampp/htdocs

 

2. Create a symbolic link between that directory and a location in the user’s home directory, eg /home/user/websites, so that it has its project in the personal folder:

sudo ln -s /opt/lampp/htdocs/home/user/Sites

Note: replace “user” with the real username.

 

Commands to be used with Xampp:

Start xampp:

sudo /opt/lampp/lampp start

Restart xampp:

sudo /opt/lampp/lampp restart

Stop xampp:

sudo /opt/lampp/lampp stop

 

If it all goes well, the user will see something like:

Starting XAMPP for Linux 1.7.4 …

XAMPP: Starting Apache with SSL (and PHP5) …

XAMPP: Starting MySQL …

XAMPP: Starting ProFTPD …

XAMPP for Linux started.

 

Before the user can start developing applications, it must always perform that previous step to start Xampp.

However, there is a GUI (graphical user interface) that allows for a quick start of all services.

It’s called Xampp Control Panel and opens with the following command:

sudo /opt/lampp/share/xampp-control-panel/xampp-control-panel

If the following error is shown when launching XAMPP from the terminal:

Error Importing pygtk2 and pygtk2-libglade

The solution is to install the corresponding library:

sudo apt-get install python-glade2

 

 

 

CREATE A LAUNCHER IN THE HOME MENU

 

For the application to show under “Applications – Other” in Ubuntu 10.10 and above and in Ubuntu 11.04 Dash applications, create a .desktop file in /usr/share/applications/:

sudo gedit /usr/share/applications/xampp-control-panel.desktop

 

Paste the following code in the file:

[Desktop Entry]

Comment = Start / Stop XAMPP

Name = XAMPP Control Panel

Exec = gksudo python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py

Icon [en_CA] = /opt/lampp/xampp.png

Encoding = UTF-8

Terminal = false

Name [en_CA] = XAMPP Control Panel

Comment [en_CA] = Start / Stop XAMPP

Type = Application

Icon = /opt/lampp/xampp.png

Save and close.

 

All what’s left is to try to see if it runs without problems.

Open the browser and type the following in the address bar:

http://localhost

The XAMPP welcome screen should open.

 

Create a php file and display its result in the browser:

The PHP files must be stored in the htdocs directory: /opt/lampp/htdocs (the user also has access to this directory by using the previously created link in its personal folder: /home/username/Sites/htdocs).

 

For example, to see the output of a file called “test.php”, enter the following in the browser address bar:

http://localhost/test.php

 

SECURITY

 

As mentioned before, XAMPP is not intended to be used in a production environment, it is just for a local development environment. XAMPP is configured to be as open as possible, allowing the developer to work without restrictions. This is great for development environments, but could be fatal in a production environment.

 

List of security vulnerabilities in XAMPP:

 

The MySQL administrator user (root) has no password.

The MySQL daemon is accessible via network.

ProFTPD uses “lampp” password  for “nobody” user.

PhpMyAdmin is accessible through the network.

MySQL and Apache run under the same user (nobody).

 

Most security vulnerabilities can be fixed by executing the following command:

sudo /opt/lampp/lampp security

 

This starts the security control, making the XAMPP installation secure.

 

Leave a Reply