adamv/homebrew-alt — Issue #113: How to bring php-fpm and nginx together?
Author: borrible13th
Created: 2011-10-15 10:42:21+00:00
State: open

I've got some problems to bring php-fpm and nginx together. Both built with brew (nginx from homebrew and php from homebrew-alt). I think my biggest problem is to configure php-fpm correctly and to start it.

The default fpm configuration uses the prefix /usr/local/Cellar/php/5.3.8 for all relative paths. I call php-fpm with -p /usr/local, so my configuration looks like that:

pid = var/run/php-fpm.pid (instead of ;pid = run/php-fpm.pid)
error_log = var/php-fpm/log/php-fpm.log (instead of ;error_log = log/php-fpm.log)
prefix = var/php-fpm/$pool (instead of ;prefix = /path/to/pools/$pool)
access.log = var/php-fpm/log/$pool.access.log (instead of ;access.log = log/$pool.access.log)

(; beside of this I always have to create the log folder.)

I try to start php-fpm with the help of following plist file in ~/Library/LaunchAgents/ similar to ~/Library/LaunchAgents/org.nginx.nginx.plist.

Label
net.php.php-fpm
RunAtLoad

UserName
USER
ProgramArguments

/usr/local/Cellar/php/5.3.8/sbin/php-fpm
-p
/usr/local

WorkingDirectory
/usr/local

The problem here it starts many, many processes regardless of very low values for pm.max_children, pm.start_servers, pm.min_spare_servers and pm.max_spare_servers.

Finally I get "Oops! This link appears broken." for a php page served by nginx.

Please, give me some advice! Or, can you provide a nice out-of-the-box working configuration file and a plist file?