#php #macos #homebrew
Вопрос:
Я получаю эту ошибку dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.4.2.dylib
при переключении версии php обратно на 8.0
.
Я могу исправить это brew reinstall php@8.0
, но это произойдет снова, когда переключится на версию.
Я использую macOS Big Sur 11.4, но у Mojave также возникла эта проблема.
Мой поток
$ php -v
PHP 7.4.19 (cli) (built: May 29 2021 10:41:11) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
(base)
$ brew install shivammathur/php/php@8.0
$ php -v
PHP 8.0.6 (cli) (built: May 14 2021 07:18:20) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.6, Copyright (c) Zend Technologies
with Zend OPcache v8.0.6, Copyright (c), by Zend Technologies
(base)
$ brew unlink php amp;amp; brew link --overwrite --force php@7.4
$ php -v
PHP 7.4.19 (cli) (built: May 29 2021 10:41:11) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
(base)
$ brew unlink php amp;amp; brew link --overwrite --force php@8.0
$ php -v
dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.4.2.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
[1] 91532 abort php -v
(base)
Информация о пакете
$ brew info php@7.4 php@8.0 openldap libiconv
php@7.4: stable 7.4.19 (bottled) [keg-only]
General-purpose scripting language
https://www.php.net/
/usr/local/Cellar/php@7.4/7.4.19 (494 files, 72.3MB)
Built from source on 2021-05-29 at 10:42:03
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/php@7.4.rb
License: PHP-3.01
==> Dependencies
Build: httpd ✔, pkg-config ✔
Required: apr ✔, apr-util ✔, argon2 ✔, aspell ✔, autoconf ✔, curl ✔, freetds ✔, gd ✔, gettext ✔, glib ✔, gmp ✔, icu4c ✔, krb5 ✔, libffi ✔, libpq ✔, libsodium ✔, libzip ✔, oniguruma ✔, openldap ✔, openssl@1.1 ✔, pcre2 ✔, sqlite ✔, tidy-html5 ✔, unixodbc ✔
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so
<FilesMatch .php
gt;
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.4/
php@7.4 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
To have launchd start php@7.4 now and restart at login:
brew services start php@7.4
Or, if you don't want/need a background service you can just run:
php-fpm
==> Analytics
install: 34,679 (30 days), 89,314 (90 days), 165,001 (365 days)
install-on-request: 34,481 (30 days), 88,821 (90 days), 164,225 (365 days)
build-error: 0 (30 days)
php: stable 8.0.6 (bottled), HEAD
General-purpose scripting language
https://www.php.net/
/usr/local/Cellar/php/7.4.12 (495 files, 72.2MB)
Built from source
/usr/local/Cellar/php@8.0/8.0 (494 files, 77.5MB) *
Built from source on 2021-04-09 at 09:59:53
/usr/local/Cellar/php/8.0.6 (500 files, 77.8MB)
Poured from bottle on 2021-05-29 at 17:48:14
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/php.rb
License: PHP-3.01
==> Dependencies
Build: httpd ✔, pkg-config ✔
Required: apr ✔, apr-util ✔, argon2 ✔, aspell ✔, autoconf ✔, curl ✔, freetds ✔, gd ✔, gettext ✔, glib ✔, gmp ✔, icu4c ✔, krb5 ✔, libffi ✔, libpq ✔, libsodium ✔, libzip ✔, oniguruma ✔, openldap ✔, openssl@1.1 ✔, pcre2 ✔, sqlite ✔, tidy-html5 ✔, unixodbc ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php_module /usr/local/opt/php/lib/httpd/modules/libphp.so
<FilesMatch .php
gt;
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/8.0/
To start php:
brew services start php
Or, if you don't want/need a background service you can just run:
/usr/local/opt/php/sbin/php-fpm --nodaemonize
==> Analytics
install: 59,614 (30 days), 153,695 (90 days), 636,046 (365 days)
install-on-request: 58,355 (30 days), 150,786 (90 days), 621,760 (365 days)
build-error: 0 (30 days)
openldap: stable 2.5.4 (bottled) [keg-only]
Open source suite of directory software
https://www.openldap.org/software/
/usr/local/Cellar/openldap/2.5.4 (339 files, 7.0MB)
Poured from bottle on 2021-05-29 at 10:13:28
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openldap.rb
License: OLDAP-2.8
==> Dependencies
Required: openssl@1.1 ✔
==> Caveats
openldap is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have openldap first in your PATH, run:
echo 'export PATH="/usr/local/opt/openldap/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/openldap/sbin:$PATH"' >> ~/.zshrc
For compilers to find openldap you may need to set:
export LDFLAGS="-L/usr/local/opt/openldap/lib"
export CPPFLAGS="-I/usr/local/opt/openldap/include"
For pkg-config to find openldap you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openldap/lib/pkgconfig"
==> Analytics
install: 119,420 (30 days), 336,001 (90 days), 1,036,075 (365 days)
install-on-request: 14,088 (30 days), 46,874 (90 days), 166,063 (365 days)
build-error: 0 (30 days)
libiconv: stable 1.16 (bottled) [keg-only]
Conversion library
https://www.gnu.org/software/libiconv/
/usr/local/Cellar/libiconv/1.16 (30 files, 2.4MB)
Poured from bottle on 2021-05-29 at 15:10:22
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libiconv.rb
License: GPL-3.0
==> Caveats
libiconv is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have libiconv first in your PATH, run:
echo 'export PATH="/usr/local/opt/libiconv/bin:$PATH"' >> ~/.zshrc
For compilers to find libiconv you may need to set:
export LDFLAGS="-L/usr/local/opt/libiconv/lib"
export CPPFLAGS="-I/usr/local/opt/libiconv/include"
==> Analytics
install: 5,992 (30 days), 14,923 (90 days), 60,385 (365 days)
install-on-request: 4,364 (30 days), 10,383 (90 days), 39,784 (365 days)
build-error: 0 (30 days)
(base)
Ответ №1:
Возникла эта проблема после полного обновления моей системы.
На данный момент PHP 7.1 и ниже устарели из Homebrew (дает предупреждение для 7.2)
Это должно работать в любом случае, кроме 7.2 и ниже:
brew reinstall php@8.0
Ответ №2:
у меня была та же проблема с php@7.3, мог бы решить эту проблему с помощью переустановки brew php@7.3
Process: php [34964]
Path: /usr/local/Cellar/php@7.3/7.3.28/bin/php
Identifier: php
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [33976]
Responsible: Terminal [33974]
User ID: 501
Date/Time: 2021-05-29 14:54:16.027 0200
OS Version: Mac OS X 10.15.7 (19H1030)
Report Version: 12
Anonymous UUID: 27971833-8B1A-565F-AF38-850B51BFF263
Sleep/Wake UUID: 97FB53F8-E8CE-4D13-8B18-35E70FBE222C
Time Awake Since Boot: 200000 seconds
Time Since Wake: 15000 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD, [0x1] Library missing
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: /usr/local/opt/openldap/lib/libldap-2.4.2.dylib
Referenced from: /usr/local/opt/php@7.3/bin/php
Reason: image not found
Binary Images:
0x10ed4c000 - 0x10f8adff3 php (0) <A7799EE4-0502-34CF-8C19-00E2B238B154> /usr/local/opt/php@7.3/bin/php
0x10faa3000 - 0x10fc62d03 libcrypto.1.1.dylib (0) <EF694AAC-B437-322C-B619-BF3EB122466C> /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib
0x10fcff000 - 0x10fd4eff7 libssl.1.1.dylib (0) <9BD08628-AC20-3489-B3D2-AC117A5BC2F8> /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
0x10fd81000 - 0x10fd91fff libzip.5.dylib (0) <01712EF1-7BA0-3073-ACE4-806C184CE3D5> /usr/local/opt/libzip/lib/libzip.5.dylib
0x10fd9c000 - 0x10fe1bff3 libtidy.5.dylib (0) <75C59099-9522-3701-8A22-276C6B65F9AF> /usr/local/opt/tidy-html5/lib/libtidy.5.dylib
0x10fe5e000 - 0x10fe62ff7 libargon2.1.dylib (0) <21EA0947-B6AC-33CF-98FF-2458872E1B8D> /usr/local/opt/argon2/lib/libargon2.1.dylib
0x10fe6a000 - 0x10fea9ffb libsodium.23.dylib (0) <D8777AB1-B4BA-324E-8E40-FEF56A1E7955> /usr/local/opt/libsodium/lib/libsodium.23.dylib
0x10fec0000 - 0x10ff0bff3 libaspell.15.dylib (0) <EE2F1867-CC5D-3417-802E-BF346085A7EC> /usr/local/opt/aspell/lib/libaspell.15.dylib
0x10ff4b000 - 0x10ff4efff libpspell.15.dylib (0) <BCDE5138-A654-30CB-BFFC-AA8C02A5F181> /usr/local/opt/aspell/lib/libpspell.15.dylib
0x10ff53000 - 0x10ff8afff libpq.5.dylib (0) <A33CB55C-781A-3D74-B9AB-2DD5DD90FB81> /usr/local/opt/libpq/lib/libpq.5.dylib
0x10ffa0000 - 0x110083ffb libsqlite3.0.dylib (0) <D721F2B6-F556-3C4C-9D2F-5C5A6B004EF6> /usr/local/opt/sqlite/lib/libsqlite3.0.dylib
0x1100af000 - 0x1100fefff libsybdb.5.dylib (0) <8308AD20-05F2-3C4B-906D-4503DB597CFB> /usr/local/opt/freetds/lib/libsybdb.5.dylib
0x11f328000 - 0x11f3b9f47 dyld (750.6) <1DCAF85D-70A4-3405-A868-25AF3DC1F32B> /usr/lib/dyld
0x7fff6e04a000 - 0x7fff6e067fff libedit.3.dylib (55) <96858F68-DEB8-3CEE-B920-C2CF13B96D30> /usr/lib/libedit.3.dylib
0x7fff6e082000 - 0x7fff6e08effb libexslt.0.dylib (16.11) <08008EC9-B665-34B6-96AA-3E4D0AD401B7> /usr/lib/libexslt.0.dylib
0x7fff6eabb000 - 0x7fff6eaeafff libncurses.5.4.dylib (57) <995DFEEA-40F3-377F-B73D-D02AC59D591F> /usr/lib/libncurses.5.4.dylib
0x7fff6f23e000 - 0x7fff6f256fff libresolv.9.dylib (67.40.1) <C57EDFEF-D36A-310B-8D14-8C68A625B1E8> /usr/lib/libresolv.9.dylib
0x7fff6f813000 - 0x7fff6f825ff3 libz.1.dylib (76) <793D9643-CD83-3AAC-8B96-88D548FAB620> /usr/lib/libz.1.dylib
Комментарии:
1. Я обновляю brew и снова переустанавливаю, он работает. Похоже, что это обновление крана: github.com/shivammathur/homebrew-php/issues/320
Ответ №3:
Тебе придется бежать brew install openldap libiconv
Для компиляторов, чтобы найти libiconv, вам может потребоваться установить:
export LDFLAGS="-L/usr/local/opt/libiconv/lib"
export CPPFLAGS="-I/usr/local/opt/libiconv/include"
Посмотрите и посмотрите, установлен ли уже openldap и запущен ли он brew upgrade openldap
Если вам нужно иметь php@7.4 первый на своем ПУТИ, беги:
echo 'export PATH="/usr/local/opt/php@8.0/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@8.0/sbin:$PATH"' >> ~/.zshrc
Наконец-то беги brew services start php@8.0
Комментарии:
1. Я обновил openldap до версии 2.5.5, но у меня все еще есть проблема.