How to start XAMPP automatically in Ubuntu after reboot - BOOKC -->

How to start XAMPP automatically in Ubuntu after reboot

Saturday, August 12, 2017

After starting using XAMPP in Ubuntu, there's a common error appeared to the users. That is considered as the failure of starting of Apache web server. We have to stop it and restart it. 

Stop Code - sudo /etc/init.d/apache2 stop
Start Code - sudo /opt/lampp/lampp start 

And the other problem is we have to start the server using a terminal command, whenever we want to use it. Here I'm going to explain a way to get rid of these two problems. If you can make XAMPP to start automatically when you reboot the machine, there you find  the  solution. This is the way to to it. 

1. First, open a terminal and type this command to edit the lampp file located in etc folder. 

       sudo gedit /etc/init.d/lampp

2. A text file will be  opened and type the following commands to add the script to make XAMPP to       be started automatically.

# Provides: lampp
# Required-Start:    $local_fs $syslog $remote_fs dbus
# Required-Stop:     $local_fs $syslog $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start lampp
/opt/lampp/lampp start

3. Save this file and close the file. If terminal is still running, press ctrl + c to terminate it.
    Then type this command.

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

4. Finally type this command also to update the relevant file.

    sudo update-rc.d lampp defaults

5. Now restart the machine!

Open the XAMPP GUI or type sudo /opt/lampp/lampp start on a  terminal to check whether XAMPP is running or not. There you will see all 3 services are running in the system. That's all....!

Enjoy the power of XAMPP!