Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

php@5.6 Library not loaded libicui18n.64.dylib #23

Closed
stevenmc opened this issue Apr 24, 2020 · 18 comments
Closed

php@5.6 Library not loaded libicui18n.64.dylib #23

stevenmc opened this issue Apr 24, 2020 · 18 comments

Comments

@stevenmc
Copy link

Mac Catalina
The current version of libicui18n is 66 and this PHP 5.6 image is referencing version 64.
Brew do not keep historic versions of icu4c.rb so it's not possible to manually revert.

`Restarting apache
httpd: Syntax error on line 184 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so into server: dlopen(/usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so, 10): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib\n Referenced from: /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so\n Reason: image not found

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
/usr/local/bin/sphp: line 170: 83278 Abort trap: 6 `

@marcelloinfoweb
Copy link

My Solution.

#14 (comment)

@fballiano
Copy link

if it's still not fixed you can try brew reinstall --build-from-source php@5.6

@JParkinson1991
Copy link

I think there are ssl issues stopping brew reinstall --build-from-source php@5.6 from running correctly.

==> Installing exolnet/deprecated/php@5.6
==> Downloading https://php.net/get/php-5.6.40.tar.xz/from/this/mirror
Already downloaded: /Users/joshparkinson/Library/Caches/Homebrew/downloads/ab2ea146f7d8c5258e6d33e9522dac5528cbc3e966bc6e5689fa57860dbb5441--php-5.6.40.tar.xz
==> Patching
patching file acinclude.m4
Hunk #1 succeeded at 444 (offset 3 lines).
Hunk #2 succeeded at 459 (offset 3 lines).
Hunk #3 succeeded at 494 (offset 3 lines).
Hunk #4 succeeded at 506 (offset 3 lines).
Hunk #5 succeeded at 2500 with fuzz 2 (offset 81 lines).
patching file Zend/zend_compile.h
patching file Zend/zend_execute.h
==> ./buildconf --force
==> ./configure --prefix=/usr/local/Cellar/php@5.6/5.6.40 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.6 --with-config-file-path=/usr/local/etc/php/5.6 --with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d --with-pear=/usr/local/Cellar/php@5.6/5.6.40/share/php@5.6/pear --ena
==> make
Last 15 lines from /Users/joshparkinson/Library/Logs/Homebrew/php@5.6/03.make:
                                   ~~~^
/usr/local/opt/openssl@1.1/include/openssl/ossl_typ.h:107:16: note: forward declaration of 'struct dsa_st'
typedef struct dsa_st DSA;
               ^
/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/openssl/openssl.c:3560:9: error: incomplete definition of type 'struct dsa_st'
        if (dsa->priv_key || dsa->pub_key) {
            ~~~^
/usr/local/opt/openssl@1.1/include/openssl/ossl_typ.h:107:16: note: forward declaration of 'struct dsa_st'
typedef struct dsa_st DSA;
               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/bin/sh /private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile clang -DHAVE_CONFIG_H -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/pcre/pcrelib -Iext/pcre/ -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/pcre/ -DPHP_ATOM_INC -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/include -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/main -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40 -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/date/lib -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/ereg/regex -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/libxml2 -I/usr/local/Cellar/krb5/1.18.1/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/curl-openssl/include -I/usr/local/opt/jpeg/include -I/usr/local/opt/libpng/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/opt/gettext/include -I/usr/local/opt/gmp/include -I/usr/local/Cellar/icu4c/66.1/include -I/usr/local/opt/openldap/include -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/mbstring/oniguruma -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/mbstring/libmbfl -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/opt/mcrypt/include -I/usr/local/opt/freetds/include -I/usr/local/opt/libpq/include -I/usr/local/opt/aspell/include/pspell -I/usr/local/opt/tidy-html5/include -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/TSRM -I/private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/Zend  -DU_USING_ICU_NAMESPACE=1 -no-cpp-precomp  -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -g -O2 -fvisibility=hidden  -c /private/tmp/php@5.6-20200427-13647-vj4pyh/php-5.6.40/ext/pcre/pcrelib/pcre_exec.c -o ext/pcre/pcrelib/pcre_exec.lo
20 errors generated.
make: *** [ext/openssl/openssl.lo] Error 1
make: *** Waiting for unfinished jobs....

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/exolnet/homebrew-deprecated/issues

These open issues may also help:
php@5.6 Library not loaded libicui18n.64.dylib https://github.com/eXolnet/homebrew-deprecated/issues/23
MacOs,  brew install exolnet/deprecated/php@5.6 errors https://github.com/eXolnet/homebrew-deprecated/issues/19
PHP 5.6 and 7.0 doesn't run on Catalina - openssl 1.0.0 needed https://github.com/eXolnet/homebrew-deprecated/issues/14

My initial thought is that php@5.6 has a dependency for openssl, which is being routed to openssl@1.1 and its this thats causing problems as it expections 1.0 version?

@stevenmc
Copy link
Author

Yes Josh,
I had this error too.
As a temporary solution, you may be able to install PHP 5.6 from here: https://php-osx.liip.ch/

But I'd obviously prefer if this brew package could be repaired.

@JParkinson1991
Copy link

JParkinson1991 commented Apr 27, 2020

Ok so i've found a proper solution to this

Backgroud

So PHP 5.6 can be recompiled to support the latest icu4c version, thus fixing the dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib error, including any other legacy version errors of this nature.. that is swap the 64 to another number. However, there is a problem in that recompilation fails for users with OpenSSL 1.1.x due to the source code (the actual C code) of the openssl extensions within PHP 5.6 not being compatibile with OpenSSL 1.1.x. Essentially in OpenSSL 1.1.x you can not access public/private keys without going through it's newly created API interfaces, which PHP 5.6 does not do. Luckily, there is a patch for the PHP 5.6 source code to make it compatible with these new interfaces.


Solutiuon

02/06/2020 Outdated solution, see bottom of this message

Ensure openssl, icu4c are at the current versions

$ brew update
$ brew upgrade icu4c
$ brew upgrade openssl

Edit the ruby file for php@5.6 to add in the patch.

$ brew edit php@5.6

In the text editor that opens add the following at lines 45-48

patch do
  url "https://raw.githubusercontent.com/opencomputeproject/Rack-Manager/master/Contrib-Inspur/openbmc/meta-openembedded/meta-oe/recipes-devtools/php/php/0001-PHP-5.6-LibSSL-1.1-compatibility.patch"
  sha256 "c9715b544ae249c0e76136dfadd9d282237233459694b9e75d0e3e094ab0c993"
end

Reinstall PHP 5.6 building from source

$ brew reinstall --build-from-source php@5.6

For me this is a much more viable soultion as i use multiple versions of PHP etc on my local machine via homebrew (https://github.com/JParkinson1991/homebrew-lemp), it would have become a nightmare for me if i had to keep installing specific legacy versions of certain packages as i was trying to switch. Patching PHP 5.6 allows me to switch between all major versions oh php without any headaches as they're all running off the same major dependencies.


Update 02/06/2020

Those finding this solution now please be aware that this change has been rolled into a pull request containing an updagte formula that does not require this manual patching.

See #25

@dmitriydzyuba
Copy link

Thanks @JParkinson1991 your solution worked for me, but it wasn't completely clear where to put the lines, so just to be clear: those should be inserted before def install line otherwise it will produce an error.

@JParkinson1991
Copy link

JParkinson1991 commented May 11, 2020

Thanks for testing @dmitriydzyuba, it would be appeciated if you could test the pull request i opened which provides new install options for php 5.6 so this manual patching it not needed.

@kythuatwebso
Copy link

brew reinstall --build-from-source php@5.6

I run command is issuse
NoMethodError: private method open' called for nil:NilClass`

nicoverbruggen added a commit to nicoverbruggen/phpmon that referenced this issue May 13, 2020
- Prevent crashes with incorrectly loading modules
- Prevent crashes when dyld libraries are missing
- Indicate when the PHP installation is broken
- New warning added at boot (multiple services)
- Added "Force load latest PHP version" option

It is known that PHP 5.6, 7.0 and 7.1 are causing issues with the
newer versions of certain libraries ("dyld library" warning).

It is recommended to only use PHP 7.2, PHP 7.3 and PHP 7.4 for a minimal
amount of issues. Otherwise, there are certain fixes that are possible
but they are not supported via PHP Monitor since they require manual
formula changes.

For more information, see:
eXolnet/homebrew-deprecated#23 (comment)
@weidmaster
Copy link

Ok so i've found a proper solution to this

Backgroud

So PHP 5.6 can be recompiled to support the latest icu4c version, thus fixing the dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib error, including any other legacy version errors of this nature.. that is swap the 64 to another number. However, there is a problem in that recompilation fails for users with OpenSSL 1.1.x due to the source code (the actual C code) of the openssl extensions within PHP 5.6 not being compatibile with OpenSSL 1.1.x. Essentially in OpenSSL 1.1.x you can not access public/private keys without going through it's newly created API interfaces, which PHP 5.6 does not do. Luckily, there is a patch for the PHP 5.6 source code to make it compatible with these new interfaces.

Solutiuon

Ensure openssl, icu4c are at the current versions

$ brew update
$ brew upgrade icu4c
$ brew upgrade openssl

Edit the ruby file for php@5.6 to add in the patch.

$ brew edit php@5.6

In the text editor that opens add the following at lines 45-48

patch do
  url "https://raw.githubusercontent.com/opencomputeproject/Rack-Manager/master/Contrib-Inspur/openbmc/meta-openembedded/meta-oe/recipes-devtools/php/php/0001-PHP-5.6-LibSSL-1.1-compatibility.patch"
  sha256 "c9715b544ae249c0e76136dfadd9d282237233459694b9e75d0e3e094ab0c993"
end

Reinstall PHP 5.6 building from source

$ brew reinstall --build-from-source php@5.6

For me this is a much more viable soultion as i use multiple versions of PHP etc on my local machine via homebrew (https://github.com/JParkinson1991/homebrew-lemp), it would have become a nightmare for me if i had to keep installing specific legacy versions of certain packages as i was trying to switch. Patching PHP 5.6 allows me to switch between all major versions oh php without any headaches as they're all running off the same major dependencies.

This worked for me! As @dmitriydzyuba said, the lines should be added before def install. So at least the install instructions should be updated to reflect this instruction, as a default install from homebrew using this repo won't run at first. And now it even runs without apache, directly from the command line, as /usr/local/opt/php@5.6/bin/php

@JParkinson1991
Copy link

@weidmaster see this PR for a less manual implementation: #25

@weidmaster
Copy link

@JParkinson1991 thanks for the PR, I will take a look. It is just that I am a brand new developer working with a Mac machine in the company and have to work with some legacy code and I just started with brew and everything else and I am glad editing some file did work.

@steinmb
Copy link

steinmb commented Aug 5, 2020

Reading up on this issue. From my understanding there still no official fix to installing php 5.6? Perhaps stupid Q but if the legacy application I try to dust off do none encryptet req/replies do I need openssl? In no, is there a easy way of just rebuild from source without openssl?

@JParkinson1991
Copy link

@steinmb given PHP 5.6 is end of life there will never be an offical fix released by the PHP team.

I have submitted a pull request however that address this issue, you should probably read it: #25

@steinmb
Copy link

steinmb commented Aug 5, 2020

Thank for your swift reply. I have a look at #25 - I know, everything up to PHP 7.2 is EOL and good riddance 😄 I only need PHP 5.6 locally to enable me to install the app, and then rewrite it to PHP 7.4/8.x.

@arvi
Copy link

arvi commented Sep 24, 2020

Ok so i've found a proper solution to this
Backgroud
So PHP 5.6 can be recompiled to support the latest icu4c version, thus fixing the dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib error, including any other legacy version errors of this nature.. that is swap the 64 to another number. However, there is a problem in that recompilation fails for users with OpenSSL 1.1.x due to the source code (the actual C code) of the openssl extensions within PHP 5.6 not being compatibile with OpenSSL 1.1.x. Essentially in OpenSSL 1.1.x you can not access public/private keys without going through it's newly created API interfaces, which PHP 5.6 does not do. Luckily, there is a patch for the PHP 5.6 source code to make it compatible with these new interfaces.
Solutiuon
Ensure openssl, icu4c are at the current versions

$ brew update
$ brew upgrade icu4c
$ brew upgrade openssl

Edit the ruby file for php@5.6 to add in the patch.

$ brew edit php@5.6

In the text editor that opens add the following at lines 45-48

patch do
  url "https://raw.githubusercontent.com/opencomputeproject/Rack-Manager/master/Contrib-Inspur/openbmc/meta-openembedded/meta-oe/recipes-devtools/php/php/0001-PHP-5.6-LibSSL-1.1-compatibility.patch"
  sha256 "c9715b544ae249c0e76136dfadd9d282237233459694b9e75d0e3e094ab0c993"
end

Reinstall PHP 5.6 building from source

$ brew reinstall --build-from-source php@5.6

For me this is a much more viable soultion as i use multiple versions of PHP etc on my local machine via homebrew (https://github.com/JParkinson1991/homebrew-lemp), it would have become a nightmare for me if i had to keep installing specific legacy versions of certain packages as i was trying to switch. Patching PHP 5.6 allows me to switch between all major versions oh php without any headaches as they're all running off the same major dependencies.

This worked for me! As @dmitriydzyuba said, the lines should be added before def install. So at least the install instructions should be updated to reflect this instruction, as a default install from homebrew using this repo won't run at first. And now it even runs without apache, directly from the command line, as /usr/local/opt/php@5.6/bin/php

Thanks! However, following this did not work for me instantly on XCode 12 and Command Line Tools 12. I had to download XCode 11.5 and Command Line Tools 11.5 (yes both of them or else it will still not work).

Make sure 11.5 is the current selected version
brew config

Then reinstall 5.6
brew reinstall --build-from-source php@5.6

then when trying to link it to be my current version I received this error:
Could not symlink sbin/php-fpm /usr/local/sbin is not writable.

So I had to do this:
sudo mkdir /usr/local/sbin
sudo chown -R $(whoami) $(brew --prefix)/sbin

Then unlink my current version and select 5.6
brew unlink php@7.4 && brew link --force --overwrite php@5.6

Then I close all terminal windows and verify my php version which is now 5.6
php -v

I found the solution of downgrading to 11.5 here: https://trac.macports.org/ticket/60988#comment:8
I was able to download previous versions at https://developer.apple.com/download/more/?name=Xcode

@koyanyaroo
Copy link

Ok so i've found a proper solution to this

Backgroud

So PHP 5.6 can be recompiled to support the latest icu4c version, thus fixing the dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib error, including any other legacy version errors of this nature.. that is swap the 64 to another number. However, there is a problem in that recompilation fails for users with OpenSSL 1.1.x due to the source code (the actual C code) of the openssl extensions within PHP 5.6 not being compatibile with OpenSSL 1.1.x. Essentially in OpenSSL 1.1.x you can not access public/private keys without going through it's newly created API interfaces, which PHP 5.6 does not do. Luckily, there is a patch for the PHP 5.6 source code to make it compatible with these new interfaces.

Solutiuon

02/06/2020 Outdated solution, see bottom of this message

Ensure openssl, icu4c are at the current versions

$ brew update
$ brew upgrade icu4c
$ brew upgrade openssl

Edit the ruby file for php@5.6 to add in the patch.

$ brew edit php@5.6

In the text editor that opens add the following at lines 45-48

patch do
  url "https://raw.githubusercontent.com/opencomputeproject/Rack-Manager/master/Contrib-Inspur/openbmc/meta-openembedded/meta-oe/recipes-devtools/php/php/0001-PHP-5.6-LibSSL-1.1-compatibility.patch"
  sha256 "c9715b544ae249c0e76136dfadd9d282237233459694b9e75d0e3e094ab0c993"
end

Reinstall PHP 5.6 building from source

$ brew reinstall --build-from-source php@5.6

For me this is a much more viable soultion as i use multiple versions of PHP etc on my local machine via homebrew (https://github.com/JParkinson1991/homebrew-lemp), it would have become a nightmare for me if i had to keep installing specific legacy versions of certain packages as i was trying to switch. Patching PHP 5.6 allows me to switch between all major versions oh php without any headaches as they're all running off the same major dependencies.

Update 02/06/2020

Those finding this solution now please be aware that this change has been rolled into a pull request containing an updagte formula that does not require this manual patching.

See #25

Still works for me (Oct 7 2020)

thanks @JParkinson1991

@marcialsoto
Copy link

I am getting this error:

brew reinstall --build-from-source php@5.6 ==> Downloading https://php.net/get/php-5.6.40.tar.xz/from/this/mirror Already downloaded: /Users/msoto/Library/Caches/Homebrew/downloads/ab2ea146f7d8c5258e6d33e9522dac5528cbc3e966bc6e5689fa57860dbb5441--php-5.6.40.tar.xz ==> Reinstalling exolnet/deprecated/php@5.6 ==> Patching ==> Patching Error: Failure while executing; patch -g 0 -f -p1 exited with 1. Here's the output: patching file acinclude.m4 Hunk #1 FAILED at 441. Hunk #2 FAILED at 456. Hunk #3 FAILED at 491. Hunk #4 FAILED at 503. Hunk #5 FAILED at 2419. 5 out of 5 hunks FAILED -- saving rejects to file acinclude.m4.rej patching file Zend/zend_compile.h Hunk #1 FAILED at 414. 1 out of 1 hunk FAILED -- saving rejects to file Zend/zend_compile.h.rej patching file Zend/zend_execute.h Hunk #1 succeeded at 80 with fuzz 2 (offset 9 lines).

@pgrenaud
Copy link
Contributor

Hi!

Thank you for your interest in this repository. Unfortunately, this repository will now be archived with no further actions. We are sorry for the inconvenience.

Why are we closing this repository? This repository was only meant as a temporary measure, not a permanent one. Its only purpose was to ease the transition, considering that formulae from the homebrew-core tap are removed almost the day they became unsupported by the vendor. We needed a few more months to allow us to upgrade the code base of the various projects we have. But it was always with the intention of doing those upgrades, not by relying on a repository to keep old php versions artificially alive. We do not condone the use of deprecated software that could lead to serious security vulnerabilities.

Why are we not redirecting to another repository? Redirecting to another repository could be interpreted as an endorsement of said repository. If we were to do such a thing, we would not do it without vetting it first. And we do not wish to put the time and energy required in a vetting process of a third party repository. As the reason why a vetting process would be required, consider this. Before installing a software library on all our developer computers from an untrusted source, we would need to make sure that this software library is free from any malicious code (Trojan, ransomware, etc.), both in the repository itself and in the packaged binaries (the homebrew bottles, if any).

Thank you for your understanding.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests