Ubuntu PHP-FPM not starting

I recently installed PHP 5.3.8 from source distribution on Ubuntu 11.04.

Here's the first parts of my configure directive:

./configure --enable-fpm --with-fpm-user=php-fpm 
--with-fpm-group=php-fpm --prefix=/usr/local/php-5.3.8 
--exec-prefix=/usr/local/php-5.3.8 
--with-config-file-path=/usr/local/php-5.3.8/etc 
--with-config-file-scan-dir=/usr/local/php-5.3.8/etc

Afterwards, I downloaded a sample for the shell script file that I used for /etc/init.d/php-fpm. I got the script from here: http://svn.php.net/repository/php/php-src/branches/PHP_5_3/sapi/fpm/init.d.php-fpm.in. I edited the file and added the paths to relevant locations and then I copied the contents to /etc/init.d/php-fpm.

I chmod +x php-fpm and then attempt to start it with ./php-fpm start and I get the following error:

Starting php-fpm [07-Sep-2011 02:55:34] ERROR: bind() for address '127.0.0.1:9000' failed: Address already in use (98)

I changed the listening port number in php-fpm.conf and I still get the same error.

One thing I noticed is that there doesn't seem to have been a php.ini file created. I've looked everywhere for it under my prefix php directory and other places. I'm not sure if this is what is causing the problem.

I'd appreciate any guidance on how I can get PHP working.

Thanks.

EDIT: This is what I get when I use the command: lsof -i -P

sshd     2267    root    3u  IPv4   3188      0t0  TCP *:22 (LISTEN)
sshd     2267    root    4u  IPv6   3190      0t0  TCP *:22 (LISTEN)
sshd    12342    root    3r  IPv4 408697      0t0  TCP WorbServer1:22->41.206.11.43.vgccl.net:30961 (ESTABLISHED)
php-fpm 12485    root    6u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12486 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12487 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12488 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12489 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12490 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12491 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12492 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12493 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12494 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12495 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12496 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12497 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12498 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12499 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12500 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12501 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12502 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12503 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12504 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)
php-fpm 12505 php-fpm    0u  IPv4 409587      0t0  TCP localhost:9000 (LISTEN)

I'm not sure why they are so many though, I'll have to look at the php-fpm.conf.


Solution 1:

You can also use

fuser 9000/tcp

That will list all the pids running on that port.. easy way to kill them all

fuser -k 9000/tcp