Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while installing PHP 7.1 for Mac (with Homebrew)

Tags:

macos

homebrew

I'm trying to install PHP 7.1 with Homebrew.

According to the Homebrew site I should type

brew install exolnet/deprecated/[email protected]

and all I get is

configure: error: Please reinstall the iconv library.

Reinstall does not help. Current version libiconv is 1.16.

How fix this error?

like image 555
DenisK Avatar asked Feb 08 '20 15:02

DenisK


1 Answers

Icu4c reinstallation made me force reinstall PHP8, which broke the purpose for me. So, I have found some new repositories where you don't need to hassle with this icu4c stuff at all:

brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]

First, delete all php installations with a command something like brew uninstall "php*" and brew unlink [email protected]

You may also need to untap other taps. I had to run

brew untap exolnet/deprecated

to install properly.

Then, if you want, delete the /usr/local/etc/php folder

then install one of the packages I've linked above.

Worked Nicely for PHP 7.1:

➜  ~ php -v
PHP 7.1.33 (cli) (built: Dec  1 2020 01:14:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

You can also quickly switch between php versions with a command like:

brew unlink php && brew link --overwrite --force [email protected]

etc.

The GitHub repository: https://github.com/shivammathur/homebrew-php

The source where I found these packages: here.

like image 172
Arda Avatar answered Sep 20 '22 06:09

Arda