Before starting installation PHP-FPM and configurations you should have Nginx installed and configured. If you don’t have it ready please follow my previous post about installing and configuring Nginx on Mac OS X. Here is the link https://www.hrupin.com/2017/11/how-to-install-nginx-webserver-on-mac-os-x

So, here we have installed and configured NGinx. Let’s install and configure PHP-FPM. Here is step by step instructions

  • Install php71 using Homebrew
  • Setup automatic launch php after mac start
  • Edit /usr/local/etc/php/7.1/php.ini and replace

    with next string
  • Edit /usr/local/etc/php/7.1/php-fpm.d/www.conf file and put there your username and group. You need find next lines and edit them like next. Please replace YOUR_USERNAME with your username and YOUR_GROUP with name of your group
  • Next we need edit default virtualhost and add make it look like this
  • Install mcrypt
  • Prepare test web content. Create file  /var/www/localhost/info.php with next content
  • Save all files and restart PHP
  • Restart Nginx
  • Check how Nginx works
  • Output should be like this
  • Also you can run http://localhost/info.php in your browser and you should see phpinfo table like this

Now Nginx able to work with PHP


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.