Thursday, September 5, 2013

You need to start XAMPP as root! [SOLVED]

Hi All,

It is hard to start XAMPP for normal users. XAMPP only start by root user. Here I have given the steps to create XAMPP Control Panel.

By using that XAMPP Control Panel normal user can start the XAMPP.

Steps :

1. Open terminal and login as root user using the root password.
     $ su root

2. Now create xampp-control-panel folder under /usr/local/
    # mkdir /usr/local/xampp-control-panel

3. Now create one script file under the xampp-control-panel folder named as xampp-control-panel.sh
    # vi /usr/local/xampp-control-panel/xampp-control-panel.sh
      [ copy and paste the below two lines in that script file ]
      #/bin/sh
      sudo /opt/lampp/share/xampp-control-panel/xampp-control-panel

4. Now save that file by pressing esc :wq

5. Give 755 permission to that script file.
    # chmod 755 /usr/local/xampp-control-panel/xampp-control-panel.sh

6. Create desktop file named as xampp.desktop under /usr/share/applications/
    # vi /usr/share/applications/xampp.desktop
      [ copy and paste the below lines in the xampp.desktop file ]
      [Desktop Entry]
      Encoding=UTF-8
      Name=Start/Stop XAMPP
      Comment=Launch XAMPP Control Panel
      Exec=/usr/local/xampp-control-panel/xampp-control-panel.sh
      Terminal=true
      Type=Application
      Icon=/opt/lampp/htdocs/favicon.ico
      Categories=Development;
      MimeType=application/xampp;

7. Now save the file by pressing esc :wq

8. Edit /etc/sudoers file to allow the users to start the xampp control panel alone without asking password.
   # vi /etc/sudoers
    [ In that file you can see the line root    ALL=(ALL)    ALL. Just add the below line next to that line ]
    
     username     ALL=NOPASSWD: /opt/lampp/share/xampp-control-panel/xampp-control-panel

9. Replace the username by actual username which you want to give access. If you don't know the username just type cd /home/ as root user in terminal and type ls command. It shows all the usernames which you have created in that system.

10. Now save the file by pressing esc :wq

11. Now XAMPP Control Panel appeared under Development section or Programming section in your system.

2 comments:

  1. Does anybody know how I might acomplish the same thing under Mac OS X Mavericks?

    ReplyDelete
  2. Thanks! If it doesn't work for you, simply edit file /etc/sudoers.d/myOverrides instead /etc/sudoers. You can also change line Terminal to false, just for clarity.

    ReplyDelete