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?
4
Answers
Try with the following
For any more details, check this guide
https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions
I had issues with this:
Solution for me was to first download https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb manually (since installing formula directly renders the error
Calling Installation of icu4c from a GitHub commit URL is disabled!
) and then:Next, copy the .dylib files from the older icu4c version somewhere temporary:
Then, reinstall icu4c:
Run php 7.1 and copy each necessary .dylib file back to your current icu4c lib folder, accordingly, until php 7.1 renders no errors.
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:
First, delete all php installations with a command something like
brew uninstall "php*"
andbrew unlink [email protected]
You may also need to
untap
other taps. I had to runto 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:
You can also quickly switch between php versions with a command like:
etc.
The GitHub repository: https://github.com/shivammathur/homebrew-php
The source where I found these packages: here.
This worked for me on Big Sur: