Restart your machine.
I upgraded PHP from 7.1 to 7.2. But Running
php -v would still show PHP 7.1.
I tried to various troubleshooting steps but nothing worked. This is a great blog post about upgrading PHP to 7.2 with troubleshooting but it didn’t help either.
Finally, I gave up and restart my machine, an old habit. Viola
php -v would show 7.2. Possibly, restarting shell would have been enough, but oh well.