1

I want to get php7.1 to install the php-gmp extension.

I upgraded PHP 5.6 to PHP 7.1. I try to install PHP extension(php-gmp) Then PHP version was downgraded to php5.6.

$ php -v
PHP 5.6.30 (cli) (built: Feb  7 2017 16:18:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

I try link back to php 7.1

~ brew link php71                             
5 10:06:43 2018 Warning: Already linked: /usr/local/Cellar/php71/7.1.13_24 To 
relink: brew unlink php71 && brew link php71

-Than I unlink php 5.6

 $ brew unlink php56
Error: No such keg: /usr/local/Cellar/php56

-I try to reinstall php7.1

$ brew install php71
==> Installing php71 from homebrew/php
Error: php71 7.1.13_24 is already installed
To upgrade to 7.1.14_25, run `brew upgrade php71`

-I show php path

$ which php
/usr/bin/php
$ cd /usr/bin/php
cd: '/usr/bin/php' is not a directory

-if I go to this path, it show v7.1. but not work with composer

usr/local/opt/php71/bin/php -v                                                
PHP 7.1.13 (cli) (built: Jan  5 2018 15:30:29) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
bfontaine
  • 18,169
  • 13
  • 73
  • 107
C.V
  • 129
  • 2
  • 9
  • https://stackoverflow.com/questions/34909101/how-can-i-easily-switch-between-php-versions-on-mac-osx – Abdulla Nilam Feb 05 '18 at 10:09
  • I already check this [https://stackoverflow.com/questions/34909101/how-can-i-easily-switch-between-php-versions-on-mac-osx](link) but, seem like difference error. and my problem also related to the shell (fish) – C.V Feb 10 '18 at 01:53

1 Answers1

1

I solved my problem by set PATH in terminal config

-In fish, I set PATH in ~/.config/fish/config.fish this way :

set -gx PATH /usr/local/opt/php71/bin $PATH

-In base

export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"
C.V
  • 129
  • 2
  • 9