I have successfully setup FPM on my OSX machine but when attempting to do the same on Ubuntu 14.04 I am experiencing a weird problem where:
- The server starts when I run php5-fpm. I can see the processes with ps -ef:
root 10 1 0 Sep16 ? 00:00:00 /bin/sh -c /usr/sbin/php-fpm -c /etc/php5/fpm/php.ini --fpm-config /etc/php5/fpm/php-fpm.conf
root 11 10 0 Sep16 ? 00:00:02 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 12 11 0 Sep16 ? 00:00:00 php-fpm: pool default
www-data 13 11 0 Sep16 ? 00:00:00 php-fpm: pool default
www-data 14 11 0 Sep16 ? 00:00:00 php-fpm: pool default
www-data 15 11 0 Sep16 ? 00:00:00 php-fpm: pool www
www-data 16 11 0 Sep16 ? 00:00:00 php-fpm: pool www
- I can telnet to the port specified (9000) in the pool configuration and there FPM does appear to be listening to this port
- Requesting any document (e.g., GET /, GET /status, GET /foobar) results in a disconnect (e.g., "Connection closed by foreign host")
Strangest of all is that doing this never results in the generation of a php_error.log file. In my php.ini file (which you can see I'm explicitly pointing to the shell command above) has the following entries regarding logs:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
These are pretty much bog-standard and if I were getting through to PHP I'd have thought I'd get something either as a PHP error or something in the FPM log. The FPM log, btw, simply states:
[16-Sep-2014 21:34:15] NOTICE: fpm is running, pid 11
[16-Sep-2014 21:34:15] NOTICE: ready to handle connections
I do find that a lot of the time these mysterious errors come down to file permissions and this is certainly a possibility here but I have checked and I think things are ok. In my php.ini file I specify a doc_root of /app/content and the file permissions look like this:
root@d7ebf59e2c13:/app# ll content
total 12
drwxr-xr-x 2 www-data www-data 4096 Sep 16 21:34 ./
drwxr-xr-x 14 www-data www-data 4096 Sep 16 21:34 ../
-rw-r--r-- 1 www-data www-data 20 Sep 16 21:33 index.php
and in the pool configuration for FPM I have:
[default]
listen = 9000
user = www-data
group = www-data
One other variable of note, which I suspect is not a part of the problem, is that I'm running this in a Docker instance. I suspect it's not a problem both because I experience the behaviour precisely the same from within the container as I do from the host environment but also because running FPM in Docker seems to be very commonly done pattern. In any case I bring it up for full disclosure and the off chance that someone has a view why this might cause problems.
Ken