php-fpm 因另一个 FPM 实例而无法重新启动

php-fpm 因另一个 FPM 实例而无法重新启动
/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]

这种情况时有发生,我不知道如何解决。

我在 CentOS 6.4 64 位上使用了来自 ius repo 的 PHP 5.4.20。

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

我的 init.d 脚本:

#! /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

答案1

那是 ius repo 错误。切换到 remi 一切正常!

相关内容