dyld: Library not loaded when installing php 7.4 with brew - php

I'm trying to install PHP 7.4 with Homebrew on MacOS Catalina. I used the following command:
brew install php#7.4
This failed during the post install step with an error about a dyld library:
dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
Referenced from: /usr/local/Cellar/php/7.4.4/bin/php
Reason: image not found
I get the same error if I try to run php from the command line afterwards.

I ran brew doctor, which advised me that the gmp keg was installed but unlinked (there were actually several versions of gmp installed). I ran:
brew link gmp
which added the missing links.
I then ran:
brew reinstall php --build-from-source
which was now able to find the gmp library.

Related

Cannot install mcrypt with homebrew and php7.4

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"

Homebrew upgrade drops PHP: dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib

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

installing amqp on mac with brew

I wanted to install amqp with pecl for my mac sierra.
I installed php with brew, with pecl install amqp I receive an error: checking for amqp using pkg-config... configure: error: librabbitmq not found
I installed with brew the librabbitmq-c package but I still get this error. I think it's somehow not synced with the pkg-config.
Does someone have an idea what to do here?
First install rabbitmq-c with brew:
brew search librabbitmq
No formula or cask found for "librabbitmq".
Closed pull requests:
Add rabbitmq-c (aka librabbitmq) formula (https://github.com/Homebrew/legacy-homebrew/pull/13437)
brew install rabbitmq-c
Then install amqp with pecl:
pecl install amqp
Set the path to librabbitmq:
Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.9.0
Verify that amqp is now installed:
php -i|grep amqp
Thanks for this walk through, it was super helpful. Just a quick note, in Mac OS 12.0.1 Monterey, the default install path for rabbitmq in homebrew is:
/opt/homebrew/Cellar/rabbitmq-c/0.11.0
I'm on MacOS High Sierra. I installed the Command_line_Tools_macOS_10.13_for_Xcode_10.1.dmg from developer.apple.com and brew installed php 8.
For the amqp extension, I used:
brew install rabbitmq-c
pecl install amqp-1.11.0beta
at the prompt
Set the path to librabbitmq install prefix [autodetect] :
I entered:
Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.11.0
The issue lies with pkg-config not being able to generate libs/cflags for librabbitmq.
$ pkg-config librabbitmq --cflags
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'librabbitmq', not found
What I did was to add both rabbitmq-c and openssl to $PKG_CONFIG_PATH as below:
export PKG_CONFIG_PATH="/usr/local/Cellar/rabbitmq-c/0.10.0/lib/pkgconfig:/usr/local/opt/openssl#1.1/lib/pkgconfig"
Then the build will succeed. (Note: I built mine with phpbrew rather than pecl, but should work).
Brew doesn't add the file to the pkg-config path, so it needed a command:
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/rabbitmq-c/0.9.0/lib/pkgconfig"
Before installing make sure the taps are up-to-date:
brew update
Then, install RabbitMQ server with:
brew install rabbitmq
In case that directory is not in PATH it's recommended to append it:
export PATH=$PATH:/usr/local/sbin
It's a combination of question and both previous answers which worked for me.
First install RabbitMQ through brew as rabbitmq-c. Then with PECL but add the config path when asked: /usr/local/Cellar/rabbitmq-c/0.10.0
Needs to be adjusted with your installed brew version of RabbitMQ.
On my M1 Mac Pro, PHP 8.2.1 the PECL install amqp rabbbitmq path it wanted is /opt/homebrew/Cellar/rabbitmq-c/0.11.0/
Hope this helps someone.

PHP intl.so fails

PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so' -
dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so, 9):
Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.56.dylib
Referenced from:
/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so Reason:
image not found in Unknown on line 0
I recently was trying to install MongoDB for PHP, I used
brew install homebrew/php/php55-mongodb
This installed a whole load of other requirements and now intl.so for PHP is broken. I get the above error whenever I run composer update and the libs I have that need intl.so now break and say its not present.
I believe this is related to the issue but it offers no solution https://github.com/Homebrew/homebrew-php/issues/2544
How can I undo this mess?
After more digging I removed, then installed intl using pecl and this seems to have worked. I also removed and then reinstalled icu4c as this is a related package that causes the issue;
sudo pecl remove intl
brew unlink icu4c
brew remove icu4c
brew install icu4c
sudo pecl install intl

mcrypt after homebrew install

I'm attempting to put together a new laravel application and tried to run php artisan to get the list of commands and it says MCrypt extention required. I am running on OSX Mavericks and ran the mrypt installation from homebrew. So now I"m stuck trying to figure out what I need to do. I am trying to get it ready so I can start messing with Vagrant.
I did go through the commands here through terminal:
brew install libjpeg
brew install pcre
brew install libxml2
brew install mcrypt
So now I'm trying to figure out why its not letting me run other commands and needing mycrpt enabled even though I already installed it.
I did the suggestions below and still when I try and run php artisan it says mycrypt php extention required.
Any ideas?
Assuming php 5.5:
brew install php55-mcrypt
If it doesn't find it:
brew tap josegonzalez/php
brew install php55-mcrypt
If it complains about not having zlib:
brew tap homebrew/dupes
brew tap josegonzalez/php
brew install php55-mcrypt
If you're on a different version of php, just change the php55 to match (php 5.3? brew install php53-mcrypt)

Categories