29

I receive the same message than explained in this thread when I'm trying to restart apache2 :

 * Restarting web server apache2 [fail]
 * There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand.

But the problem is that I don't have any file inside /var/run/apache2. The command pidof apache2 returns :

1274

I don't know if it will help but here is the line in apache2.conf :

PidFile ${APACHE_PID_FILE}

And the one in envvars :

export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid

Should I manually create a .pid file inside /var/run/apache2 ?

Thank you very much !

  • How was Apache installed? LAMP, nginx, XAMPP? Upstart may not know how to handle the instance you installed if they are still invoking scripts in init.d – douggro Mar 9 '14 at 22:09
  • I installed Apache via sudo apt-get install on Ubuntu 13.10 (on an Azure virtual machine). Do I need to type a specific command to know the invoking scripts ? – Ivan Gabriele Mar 9 '14 at 22:14
  • 2
    sudo kill -9 1274 then try service apache2 status If it comes back with stopped/waiting then sudo service apache2 start – douggro Mar 9 '14 at 23:58
  • Wow it worked perfectely ! I feel dumb not to have tried that before... Thank you very much @douggro ! – Ivan Gabriele Mar 10 '14 at 16:34
  • @douggro You should enter sudo kill -9 <pid> as an answer. It worked for me too. – inorganik Aug 21 '14 at 14:16
30

Thanks to @douggro who found the answer.

Find the processus id of Apache2 with :

pidof apache2 

Kill the process(es) :

sudo kill -9 <pid>

Then you can start Apache2 as usually :

sudo service apache2 start

UPDATE

If sudo kill -9 <pid> doesn't work, just try sudo kill <pid> !

| improve this answer | |
  • 4
    You might edit your answer to include the details and make it more useful. Comments aren't meant to store lasting information. – Seth Nov 12 '14 at 1:05
  • 1
    Not working for me on Ubuntu 14.04. – Nitesh Verma Mar 1 '17 at 9:33
1

After trying various one liners that did not work I found this

kill -9 $(pidof apache2)

that seems to work just fine

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.