Ubuntu 12.04 Tips and Tricks

In this article we would make a script to start XAMPP automatically in Ubuntu.

In last article we installed XAMPP in Ubuntu. But we need to execute following command to start it every time.

sudo  /opt/lampp/lampp start

For a web developer XAMPP is the primary application. To start it every time whenever you login is vey tedious task.

But we can make a script which will automatically start it on login.

Open terminal and run following command.

sudo gedit /etc/init.d/lampp

xampp gedit lampp

paste following code in open file

#!/bin/bash
/opt/lampp/lampp start

xampp script code

save and close the file

run following command to make this script executable

sudo chmod +x /etc/init.d/lampp

xampp chmod

run following command to install init scripts to all runlevel

sudo update-rc.d lampp defaults

xampp update

restart the system

xampp reboot

xampp would be start automatically. You can check it by opening http://localhost in browser

xampp welcome xampp

you can also verify it by opening http://localhost/phpmyadmin

xampp welcome phpmyadmin