Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
/etc/init.d/php-fpm restart
Stopping php-fpm:                                          [FAILED]
Starting php-fpm: [10-Oct-2013 21:24:37] ERROR: An another FPM instance seems to already listen on /home/php-fpm/sock/gosianozka.sock
[10-Oct-2013 21:24:37] ERROR: FPM initialization failed
                                                           [FAILED]

It happens from time to time and I don't have any idea how to fix it.

I'm using PHP 5.4.20 from ius repo on CentOS 6.4 64-bit.

PHP 5.4.20 (cli) (built: Sep 20 2013 10:06:51)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.4.3, Copyright (c) 2002-2013, by ionCube Ltd., and
    with SourceGuardian v9.5, Copyright (c) 2000-2013, by Inovica Ltd.
    with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

My init.d script:

#! /bin/sh
#
# chkconfig: - 84 16
# description:  PHP FastCGI Process Manager
# processname: php-fpm
# config: /etc/php-fpm.conf
# pidfile: /var/run/php-fpm/php-fpm.pid

# Standard LSB functions
#. /lib/lsb/init-functions

# Source function library.
. /etc/init.d/functions

# Check that networking is up.
. /etc/sysconfig/network

# Additional environment file
if [ -f /etc/sysconfig/php-fpm ]; then
      . /etc/sysconfig/php-fpm
fi

if [ "$NETWORKING" = "no" ]
then
    exit 0
fi

RETVAL=0
prog="php-fpm"
pidfile=${PIDFILE-/var/run/php-fpm/php-fpm.pid}
lockfile=${LOCKFILE-/var/lock/subsys/php-fpm}

start () {
    echo -n $"Starting $prog: "
    dir=$(dirname ${pidfile})
    [ -d $dir ] || mkdir $dir
    daemon --pidfile ${pidfile} php-fpm --daemonize
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch ${lockfile}
}
stop () {
    echo -n $"Stopping $prog: "
    killproc -p ${pidfile} php-fpm
    RETVAL=$?
    echo
    if [ $RETVAL -eq 0 ] ; then
        rm -f ${lockfile} ${pidfile}
    fi
}

restart () {
        stop
        start
}

reload () {
    echo -n $"Reloading $prog: "
    killproc -p ${pidfile} php-fpm -USR2
    RETVAL=$?
    echo
}


# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status -p ${pidfile} php-fpm
    RETVAL=$?
    ;;
  restart)
    restart
    ;;
  reload|force-reload)
    reload
    ;;
  condrestart|try-restart)
    [ -f ${lockfile} ] && restart || :
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
    RETVAL=2
        ;;
esac

exit $RETVAL
share|improve this question
1  
Hard to give you a good answer here - there can be a lot of things to look at. Does the PID file exist? Is it taking too much time to kill all the children? When it happens, can you "stop" it without restart? When you have issued "restart" and it fails like that - will PHP-FPM eventually die after a while? –  Frands Hansen Oct 10 '13 at 20:56
    
Yes. It does. I'm unable to stop too. PHP-FPM continue to work despite this error. –  Spacedust Oct 11 '13 at 9:35
add comment

1 Answer

That was ius repo bug. Switched to remi and all works fine !

share|improve this answer
add comment

Your Answer

 
discard

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.