php -v and php-fpm -v show different versions of php php -v and php-fpm -v show different versions of php nginx nginx

php -v and php-fpm -v show different versions of php


Okay I've now got both php -v and php-fpm -v returning the same value of php and i did it by running brew doctor which told me to run echo 'export PATH="/usr/local/sbin/:$PATH"'

so now that I have the same versions running and can confirm that php-fpm is running without failing using lsof -i | grep php-fpm I'm on to normal problems that people have installing php and nginx on their mac books! So I can rest easy tonight knowing that I am slightly closer to my goal!

I also now have the following

$ which php-fpm/usr/local/sbin/php-fpm$ which php/usr/local/bin/php

Thank you everyone for your time and suggestions :)


For me, I have the following architecture after installing php (not with brew) but perhaps this will help anyway...

ls /etc/php/5.6  7.0  7.1  7.2

and I have the following commands available if I type php and tab:

php            php-config     php-config7.2  php-fpm7.2     php7.2         phpdismod      phpenmod       phpize         phpize7.2      phpquery

I have a service running specifically for php-fpm7.2 as seen here:

sudo service php7.2-fpm status * php-fpm7.2 is runningroot@xxx:~# sudo service php5.6-fpm statusphp5.6-fpm: unrecognized serviceroot@xxx:~# sudo service php7.1-fpm statusphp7.1-fpm: unrecognized service

The fact you are getting a different version with php is because that is the version of php that runs in the command line - and it has different settings than what will happen when you use fpm (passed through from nginx). I don't think the CLI php has much to do with your fpm versions. It could be that brew's repositories for php are only up to date for fpm 7.16.. I think I might be installing my PHP from a ppa but I cannot recall off the top of my head.