Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using nginx and php5-fpm on my Ubuntu box for a while now. Everything has been configured and setup correctly, and it ran like a charm.

I have been keeping the packages updated & upgraded as usual, but haven't touched the nginx OR php5-fpm config files at all (thus I'm pretty sure this isn't my fault... )

Basically, I noticed nginx wasn't running as it should be. I ran the command sudo service nginx start, and the script did nothing. The same thing happens when trying to do anything - start, stop, restart or reload. This also happens for the "php5-fpm" init script - although all other init scripts seem to be functioning correctly.

When trying to start nginx OR php5-fpm, this is what happens:

root@HAL:/etc# service php5-fpm start

I can't understand what is going wrong. The script isn't returning errors, but similarly it isn't starting the daemon or reporting success as usual.

For reference, both installations are from the official nginx and php5-fpm PPAs. The fact that both started doing this at the same time has thrown me - since they are both unrelated packages.

I have since purged both sets of packages from my system with apt-get purge ... and also apt-get remove --purge ... both of which have successfully removed the packages, their config files, and their init.d startup scripts.

After having reinstalled nginx, I now have a functioning startup script again - I can start the web server as usual. However, php5-fpm is still experiencing the strange premature exiting of the startup script.. and I really can't figure out what's causing it.

I have no idea what caused this to occur initially, but have managed to fix nginx. I now need to fix the php5-fpm startup script.

If anybody could shed some light on this situation, I would be very grateful! The chances are both these issues are related - and they were caused by me doing something stupid. But now I need to fix it. This time I was lucky - because these problems are just on my development server. But I have 2 other live servers which are configured in a similar way, and I am worried the same thing will happen to these two as well!

Has anybody else come across this? Do you have any words of advice?

Thank you

share|improve this question
Thanks for this womble! I have never delved into bash too much, so was unaware of this flag. You put me on the right path, and I was able to solve my own problems with this. I just can't post my answer yet for another 7 hours with my low reputation! ;) – Ollie Treend Apr 7 '12 at 8:07
Building on that, when a service won't start, it's good to check for some zombie processes. Checking the processes with ps can show that php5-fpm processes might still be running. Use ps aux | grep php showed them and get their PID. Then use kill <pid-of-process> (minus greater-than/less-than characters). – fideloper Jul 26 '14 at 14:22
up vote 5 down vote accepted

I don't know what's causing this problem in particular, however in general if you're having troubles with a script (such as an init script) it's worth running it under a shell with the -x option (eg /bin/bash -x /etc/init.d/php5-fpm start), which will print out a full trace of the script's execution, which will almost certainly make it obvious what's going wrong.

share|improve this answer
Thanks again womble. Running it under bash -x showed me where the script was falling over. Turns out there were some old php5-fpm processes bound to the same port. I thought the init.d script would have told me this originally, so didn't consider that could have been the case. After killing those processes and running the init.d script again, it came back to life as if by magic! ;) – Ollie Treend Apr 7 '12 at 8:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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