Monday, November 01, 2010

php-fpm with nginx on macosx

PHP 5.3.3 is bundled with php-fpm, however the macports version doesn't have a fpm variant yet. There are very few blogs that talk about setting up php-fpm with nginx on macosx. So I have documented here the steps I have followed to get them working.

1)port uninstall installed and php5
2)port selfupdate
3)edit /opt/local/var/macports/sources/
and add "--enable-fpm" option to the configure.args. More details about this can be found at
4)Install the fastcgi variant of php "port install php +fastcgi"
5)Check if you have /opt/local/sbin/php-fpm binary
6)Configure /opt/local/etc/php-fpm.conf
7)Create a plist file called org.macports.phpfpm.plist. I created a simple plist file with /opt/local/sbin/php-fpm as the only string tag. I suggest that you read about plist files and create a proper plist file.
8)copy the plist file to /Library/LaunchDaemons/org.macports.phpfpm.plist
9)add the plist to file to startup "sudo launchctl load -w /Library/LaunchDaemons/org.macports.phpfpm.plist"
10)reboot the machine, verify if php-fpm is running. "ps aux | grep fpm"

No comments: