15
votes

I have painfully analyzed all of yesterday if I had another apache/web-server instance running, with all of these commands

ps aux
ps -e
lsof 
netstat tunap

I DO NOT have another instance of Apache or ANY OTHER server running at port 8080.

Yet, XAMPP gives me this:

XAMPP: Another web server daemon is already running

What should I do?

I also edited httpd.conf to LISTEN to port 9876, and still the same.

11

11 Answers

18
votes
 sudo rm /opt/lampp/logs/httpd.pid
// get listen pid
 sudo netstat -nap | grep :80

example of output:

tcp6   0  0 :::80  :::*  LISTEN  14417/httpd

PID is 14417

kill proc

 sudo kill 14417

start/restart lampp server

 sudo /opt/lampp/lampp restart
11
votes

If:

lsof -Pi |grep 8080        returns no results
netstat -na |grep 8080     returns no results
ps -ef                     shows no web server processes

Then maybe there's a lockfile lying around that the startup is checking against? Those are typically found under /var/run but don't necessarily have to. At this point I would usually run strace to see what's going on:

strace -e read=all -e write=all -f -o strace.out your_startup_command

Then open up strace.out, search for the "..is already running" string in the output, and starting looking at lines above it to see what is failing.

8
votes

I didn't have any server running either, but I found this command that saved me:

sudo lsof -i :80

It displayed something like this for me:

COMMAND     PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Skype      4275    root   61u  IPv4 0x869da9d5a8e5506b      0t0  TCP *:http (LISTEN)

So killing Skype made it work.

7
votes

Mind the port-check in start-script

If you changed your xampp apache to listen to another port (/opt/lampp/etc/httpd.conf --> "Listen 80" is now "Listen 82"), then you also have to change the port-check in the /opt/lampp/xampp start script.

Just search in the /opt/lampp/xampp for the line with

'Another web server is already running.'

and search in the previous lines for:

if testport 80

change it to:

if testport 82

With that you can start an xampp on port 82 and keep your regular webserver on port 80 running.

6
votes
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop
sudo /etc/init.d/proftpd stop

This solution seems to work. You must restart lampp:

sudo /opt/lampp/lampp restart

Solution tested for Ubuntu 12.04 after a similar problem.

3
votes

I solved this problem disabling ssl port

sudo /opt/lampp/lampp disablessl

and then

sudo /opt/lampp/lampp start
3
votes

Below command should work for me

  sudo service apache2 stop

then

  sudo /opt/lampp/lampp restart
1
votes

The above solution didn't work for me. But this solution did -

sudo apachectl stop

And then restart apache, mysql if XAMPP GUI is available or restart from terminal (in Ubuntu) -

sudo /opt/lampp/lampp restart
1
votes

you can do that from a command shell using:

sudo netstat -ltnp | grep :80

In the last column you'll see: pid / process_name.You can use later, below command to stop the process:

 ps aux | grep process_name

after this try to restart lampp, using :: sudo /opt/lampp/lampp restart

0
votes

First just run sudo xampp it should show the list of available operations. If not, then there is a problem in xampp installation(It's another question).

Second run sudo /opt/lampp/manager-linux-x64.run This will open a GUI. In GUI you can start and stop server(apache, sql). It may work in most cases.

If it is not starting in GUI, then change the port. (There is an option to change the port in GUI). Now it may work.

If the GUI option doesn't work for you, then try next.

Option 1. Open /opt/lampp/logs/error_log file and read last 10 lines.

In my case the error is could not bind to address [::]:80 . This informs that port 80 is used by another service. Option are, change our apache server port at GUI or /opt/lampp/properties.ini file ("Sometimes you have to log-out of system and login again to work.") or stop the server that using this port.

Hint: Here 80 is used so try 81 and so on..

Option 2. Do the following steps.

Stop xampp sudo xampp stop

then

sudo /etc/init.d/apache2 stop

sudo /etc/init.d/mysql stop

sudo /etc/init.d/proftpd stop

then

Start xampp sudo xampp start

-1
votes

Below command should work in all scenarios to stop Mysql services :

sudo service mysql stop

After tapping this start lampp service using below command :

sudo /opt/lampp/lampp start