I have a problem when I try to install PHP 8 on macOS. I use the following commands :
brew tap shivammathur/php
brew install shivammathur/php/php#8.0
brew link --overwrite --force php#8.0
But after, when I try to execute php -v I have this result :
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicuio.67.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
[1] 28817 abort php -v
Can you help me ? It seems my $PATH var has a problem.
Thanks
Try
brew install icu4c
or
brew reinstall icu4c
it solved for me
Related
Installed php#5.6 and php#8.1 with brew. php -v shows php#5.6 after brew link php#5.6 --force --overwrite (normal).
Then, after using brew unlink php#5.6 and brew link php --force --overwrite to switch to php#8.1, php -v still displays php#5.6.
In other words, I'm stuck with php#5.6 and cannot switch to php#8.1.
I know I edited a config file and added a line specifying php#5.6, but I can't remember which file it was.
How can I switch to php#8.1?
I'm using brew in Ubuntu via WSL 2 under Windows. Thanks.
try splitting the command into two like so
brew unlink php && brew link --overwrite --force php#8.1
The command above works for me.
Ref: https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions
OS: macOS 11 (big sur)
Homebrew: 2.5.12
PEAR Version: 1.10.12
I just upgraded the php on my mac from php7.1 to php7.4 with homebrew (brew install php#7.4).
Then, when I try to install mcrypt extension, I got the error:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
ERROR: `/private/tmp/pear/install/mcrypt/configure --with-php-config=/usr/local/homebrew/opt/php#7.4/bin/php-config --with-mcrypt' failed
Here is what I did:
brew isntall mcrypt
install the pecl
sudo pecl install mcrypt -- The error goes here.
What I tried:
Located the mcrypt.h and put manually the file to the several locations (based on the php-config), not work.
Cleaned the brew and reinstall/relink the mcrypt(libmcrypt), not work.
Removed the legacy mcrypt files of the old brew version.
I ran into the same problem. So after installing libmcrypt with brew install mcrypt it seems like configure is not able to resolve the path to mcrypt.h automatically. It also does not work to specify the CPPFLAGS or giving the homebrew include path.
But I found a solution that works for me by giving pecl the install location of mcrypt in the Homebrew Cellar. This is what the following code does automatically:
pecl install mcrypt <<<"$(ls -d $(brew --prefix)/Cellar/mcrypt/* | tail -1)"
if you using brew try this :
1.Unistall existing php then Install shivammathur/php
add shivammathur php
brew tap shivammathur/php
change php version with you needed (5.6 or 7.2 or 7.4 or 8.1 or next version)
brew install shivammathur/php/php#7.4
2.Install shivammathur/extensions it s will add extension to php
then
brew tap shivammathur/extensions
brew install shivammathur/extensions/mcrypt#7.4
then you install mcrypt with same version as php version
brew install mcrypt#7.4
then restart httpd
brew services restart httpd
Ref :
https://github.com/shivammathur/homebrew-php
https://github.com/shivammathur/homebrew-extensions
The problem here is the configure command can't find the libmcrypt installed by homebrew
You can
Download the source code of mcrypt-1.0.4, then cd in the folder
run "phpize"
run "./configure --with-mcrypt=/opt/homebrew/Cellar/mcrypt/2.6.8", you can change the path here with your path for homebrew lib
run "make && make install"
add extension=mcrypt.so to your config file
ps: Use php -i | grep "Loaded Configuration File" to locate your php configure file
in case of an error on macOS use the complete path in php.ini like:
extension="/opt/homebrew/Cellar/php/8.1.9/pecl/20210902/mcrypt.so"
How to configure PHP 7.4.X in to mac where as it shows 7.2.8 on Php -v command. I tried to install latest version of XXAMP which come with 7.4.8 but still the problem remains the same.
You can use brew to achieve this:
$ brew unlink php#7.2
$ brew install php#7.4
$ brew link php#7.4 --force
Then in the future you can reverse this by doing this:
$ brew unlink php#7.4
$ brew link php#7.2 --force
Today I upgraded Homebrew and this causes PHP versions (7.2 - 7.3) to be dropped. the following error is shown whenever I try to reinstall them:
dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib
Referenced from: /usr/local/opt/curl-openssl/bin/curl
Reason: image not found
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "php"
Download failed: https://www.php.net/distributions/php-7.3.9.tar.xz
Any suggestions?
Okay, I've solved this by installing this library brew install libpsl
then reinstall php brew reinstall php#7.2 --build-from-source
also the same for php#7.3
Be aware that reinstalling php will reset all php configurations
It's a bug after php was migrated to OpenSSH 1.1. There's no need to install libpsl.
The problem has been fixed by pr-44048. You should uninstall libpsl and reinstall php.
brew uninstall libpsl
brew reinstall php
Removing the Cellar folder and installing the PHP again worked for me.
rm -rf /Users/rafaelgomes/.composer/*
rm -rf /usr/local/Cellar/*
brew doctor ; brew update ; brew upgrade
brew install php
I've solved this by doing the following
brew uninstall libpsl
brew remove php
brew install libpsl
brew install php#8.0
I had a problem which appeared all of the sudden saying:
Unable to determine linked PHP. which I could not solve so I uninstalled valet, php and dependencies. Then I installed fresh php7.1 but when I run valet install I get quiet slightly similar error: Homebrew PHP appears not to be linked.
First, find the PHP version installed via.
brew list
In my case it was php#7.3, then
brew link php#7.3 --force --overwrite
and finally
valet install
:)
Homebrew can't find the correct PHP version, have you linked them up properly?
brew link php71
brew link php#7.2 --force --overwrite
That will push this--
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/php#7.2/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.2/sbin:$PATH"' >> ~/.bash_profile
I ran both independently then tried valet install (worked like a charm).
brew install php#7.1
then link it
brew link php#7.1 --force --overwrite
$ brew unlink php && brew link --force php#7.1
If you are coming here following a migration from Intel to M1 and having Valet not use the php cask from the /opt/ folder, this did the trick for me:
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc.