php-fpm 启动时显示“失败”

php-fpm 启动时显示“失败”

我运行的是 Ubuntu 13.04。我安装了 nginx 包,并从源代码编译了 php-5.4.15 来运行 php-fpm。问题是,当我这样做时

 sudo service php-fpm start

我有

 Starting php-fpm ................................... fail

但是 php-fpm 确实启动了,而且我可以在本地 nginx 服务器上显示 phpinfo 页面,所以我不明白为什么会收到此失败消息。同样,如果在启动 php-fpm 后,我

 sudo service php-fpm restart

我有

Gracefully shutting down php-fpm warning, no pid file found - php-fpm is not running ?
Starting php-fpm [30-May-2013 07:54:23] ERROR: unable to bind listening socket 
for address '127.0.0.1:9000': Address already in use (98)
[30-May-2013 07:54:23] ERROR: FPM initialization failed
failed

您知道这个问题可能出在哪里吗?谢谢!

这是我的./configure 说明:

./configure \
    --enable-fpm \
    --enable-pdo \
    --with-pdo-mysql \
    --enable-sockets \
    --enable-exif \
    --enable-soap \
    --enable-ftp \
    --enable-wddx \
    --enable-pcntl \
    --enable-soap \
    --enable-bcmath \
    --enable-mbstring \
    --enable-dba \
    --enable-gd-native-ttf \
    --enable-zip \
    --enable-calendar \
    --with-mysql \
--with-mysql-sock \
    --with-mysqli \
    --with-pdo-sqlite \
    --with-iconv \
    --with-zlib \
    --with-bz2 \
    --with-gettext \
    --with-xmlrpc \
    --with-openssl \
--enable-shmop \
    --with-mhash \
    --with-mcrypt \
--with-kerberos \
--with-imap \
--with-imap-ssl \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
    --with-xsl \
    --with-curl \
--enable-intl \
    --with-pcre-regex \
    --with-gd \
    --with-freetype-dir=/usr \
    --with-jpeg-dir=/usr/lib \
    --with-png-dir=/usr/lib \
--with-libxml-dir=/usr/lib \
--with-t1lib=/usr \
    --with-ldap=/usr \
    --with-pear \
    --with-fpm-user=www-data \
    --with-fpm-group=www-data \
    --with-config-file-path=/etc/php-5.4.15/ \
    --with-config-file-scan-dir=/etc/php-5.4.15/conf.d/ \
--with-libdir=lib

php-fpm.conf:

  pid = /var/run/php-fpm.pid
  listen = 127.0.0.1:9000

Nginx 默认设置:

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #       # With php5-cgi alone:
            fastcgi_pass 127.0.0.1:9000;
    #       # With php5-fpm:
    #       fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }

答案1

用 彻底终止它,killall php-fpm然后重新启动。看起来 init 脚本只是找不到 .pid 文件,并抛出了虚假错误。

相关内容