shivammathur / homebrew-php

:beer: Homebrew tap for PHP 5.6 to 8.4. PHP 8.4 is built nightly.

Home Page:https://github.com/shivammathur/homebrew-php/packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP 8.1 issues after brew upgrade

dyanakiev opened this issue · comments

Describe the bug
When i run any php command i get the following errors:

─$ php -v
dyld[3763]: Library not loaded: /opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib
  Referenced from: /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/php
  Reason: tried: '/opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file), '/opt/homebrew/Cellar/openldap/2.6.0/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file)
[1]    3763 abort      php -v

So far i have tried brew update, brew upgrade, brew doctor, brew install shivammathur/php/php@8.1,brew unlink php@8.1 && brew link php@8.1...

Interesting is this output stating Warning: Already linked:

╰─$   brew unlink php@8.1 && brew link php@8.1
Unlinking /opt/homebrew/Cellar/php/8.1.0_1... 0 symlinks removed.
Warning: Already linked: /opt/homebrew/Cellar/php@8.1/8.1.0_3
To relink, run:
  brew unlink php@8.1 && brew link php@8.1

PHP versions
8.1

Probably related to #674 but the fix there didn't work either.

@dyanakiev

Duplicate #674

Openldap has been updated to 2.6.0 and all the PHP versions have been re-built with the new version.

Run brew update and then reinstall the PHP version.

For example for PHP 8.1

brew update
brew reinstall shivammathur/php/php@8.1
brew unlink php@8.1
brew link --force --overwrite php@8.1

@shivammathur thanks i just tried that:

Last login: Thu Nov 25 22:56:13 on ttys000
╭─dimitar@Dimitars-MacBook ~
╰─$ brew update
brew reinstall shivammathur/php/php@8.1
brew unlink php@8.1
brew link --force --overwrite php@8.1
Already up-to-date.
==> Downloading https://ghcr.io/v2/shivammathur/php/php/manifests/8.1.0_1
Already downloaded: /Users/dimitar/Library/Caches/Homebrew/downloads/9d0caebf87ea0030c673b504558200a92f348f92f8158f03b41acb2bae861bdf--php-8.1.0_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/shivammathur/php/php/blobs/sha256:02043cd1397
Already downloaded: /Users/dimitar/Library/Caches/Homebrew/downloads/5479673f07fa684f37e531ad207d27841feed60b24d4ef31249fdb2957179de8--php--8.1.0_1.arm64_big_sur.bottle.tar.gz
==> Reinstalling shivammathur/php/php
==> Pouring php--8.1.0_1.arm64_big_sur.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /opt/homebrew
Could not symlink bin/pear
Target /opt/homebrew/bin/pear
is a symlink belonging to php@8.1. You can unlink it:
  brew unlink php@8.1

To force the link and overwrite all conflicting files:
  brew link --overwrite php

To list all files that would be deleted:
  brew link --overwrite --dry-run php

Possible conflicting files are:
/opt/homebrew/bin/pear -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/pear
/opt/homebrew/bin/peardev -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/peardev
/opt/homebrew/bin/pecl -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/pecl
/opt/homebrew/bin/phar -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/phar
/opt/homebrew/bin/phar.phar -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/phar.phar
/opt/homebrew/bin/php -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/php
/opt/homebrew/bin/php-cgi -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/php-cgi
/opt/homebrew/bin/php-config -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/php-config
/opt/homebrew/bin/phpdbg -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/phpdbg
/opt/homebrew/bin/phpize -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/phpize
/opt/homebrew/sbin/php-fpm -> /opt/homebrew/Cellar/php@8.1/8.1.0_3/sbin/php-fpm
Error: Could not symlink include/php/TSRM/TSRM.h
Target /opt/homebrew/include/php/TSRM/TSRM.h
is a symlink belonging to php@8.1. You can unlink it:
  brew unlink php@8.1

To force the link and overwrite all conflicting files:
  brew link --overwrite php@8.1

To list all files that would be deleted:
  brew link --overwrite --dry-run php@8.1
Unlinking /opt/homebrew/Cellar/php/8.1.0_1... 0 symlinks removed.
Warning: Already linked: /opt/homebrew/Cellar/php@8.1/8.1.0_3
To relink, run:
  brew unlink php@8.1 && brew link php@8.1
╭─dimitar@Dimitars-MacBook ~
╰─$ php -v
dyld[5375]: Library not loaded: /opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib
  Referenced from: /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/php
  Reason: tried: '/opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file), '/opt/homebrew/Cellar/openldap/2.6.0/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file)
[1]    5375 abort      php -v
╭─dimitar@Dimitars-MacBook ~
╰─$ zsh                                                                                                                            134 ↵
╭─dimitar@Dimitars-MacBook ~
╰─$ pvp -v
╭─dimitar@Dimitars-MacBook ~
╰─$ php -v                                                                                                                         130 ↵
dyld[5615]: Library not loaded: /opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib
  Referenced from: /opt/homebrew/Cellar/php@8.1/8.1.0_3/bin/php
  Reason: tried: '/opt/homebrew/opt/openldap/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file), '/opt/homebrew/Cellar/openldap/2.6.0/lib/libldap-2.5.0.dylib' (no such file), '/usr/local/lib/libldap-2.5.0.dylib' (no such file), '/usr/lib/libldap-2.5.0.dylib' (no such file)
[1]    5615 abort      php -v
╭─dimitar@Dimitars-MacBook ~
╰─$                                                                                                                                134 ↵

Well.. what solved my issue was:

brew link php - with is weird..
then brew reinstall shivammathur/php/php@8.1

and everything is working

@shivammathur still i get some issues... apperently i cant link php@8.1

Last login: Thu Nov 25 23:12:33 on ttys003
╭─dimitar@Dimitars-MacBook ~
╰─$ php -v
zsh: command not found: php
╭─dimitar@Dimitars-MacBook ~
╰─$   brew unlink php@8.1 && brew link php@8.1                            127 ↵
Unlinking /opt/homebrew/Cellar/php/8.1.0_1... 0 symlinks removed.
Warning: Already linked: /opt/homebrew/Cellar/php@8.1/8.1.0_3
To relink, run:
  brew unlink php@8.1 && brew link php@8.1
╭─dimitar@Dimitars-MacBook ~
╰─$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  php
╭─dimitar@Dimitars-MacBook ~
╰─$ php -v                                                                  1 ↵
zsh: command not found: php
╭─dimitar@Dimitars-MacBook ~
╰─$                                                                                                            127 ↵

ok, you had the old php@8.1, package

Please run

sudo rm -rf /opt/homebrew/Cellar/php@8.1/8.1.0_3
brew unlink php
brew link php
# Then check
php -v

Unfortunately, I experienced the same error.

For me it was fixed after I unlinked and uninstalled all php versions with brew and after that reinstalled all php versions I need

@sjerdo i still have some issues with linking/unlinking and i dont understand why.. i will probably purge homebrew and install again..