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.

I run Ubuntu 13.04. I installed the nginx package and I compiled php-5.4.15 from source to run php-fpm. The problem is that when I do

 sudo service php-fpm start

I got

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

But php-fpm does start and I can display a phpinfo page on my local nginx server so I do not understand why I got this fail message. Same thing, if after starting php-fpm, I do

 sudo service php-fpm restart

I got

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

Do you have any idea on where this problem could come from? Thank you!

Here is my ./configure instructions:

./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 default:

    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;
    }
share|improve this question

1 Answer 1

Completely kill it with killall php-fpm then start again. It looks like the init script just couldn't find a .pid file and is tossing false errors.

share|improve this answer
    
Thanks for you answser but it does not work. This problem appears event when I reboot my laptop (php does not start with the system, I didn't add it to system init script). –  JuCachalot May 30 '13 at 15:12
    
What's the output of netstat -lpn | grep 9000? It'll show what process is using the port, which you then can kill with kill -9 pid. –  Nathan C May 30 '13 at 15:54
    
After starting my PC, sudo netstat -lpn | grep 9000 outputs nothing. Then I do sudo service php-fpm start, and it displays Starting php-fpm ........fail but actually starts because the output of netstat now shows tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 4118/php-fpm.conf). But why does it say "fail" in the first place?? –  JuCachalot May 30 '13 at 19:02
    
It's probably the init script messing up. You can review the startup log/init script to see, but if it's working then you can probably safely ignore it. –  Nathan C May 30 '13 at 19:24
1  
Well, it's just that I'm an idiot. My php-fpm.conf file had the directive pid = /var/run/php-fpm.pid and the default prefix is /usr/local/var. The init.d/php-fpm script had the directive php_fpm_PID=${prefix}/var/run/php-fpm.pid so I just edited my php-fpm.conf file like this pid = run/php-fpm.pid and now everything works perfect! Thanks for your help! –  JuCachalot May 30 '13 at 19:31

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.