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

PHP 5.6 and 7.0 doesn't run on Catalina - openssl 1.0.0 needed #14

Closed
focalstrategy opened this issue Nov 24, 2019 · 26 comments
Closed

Comments

@focalstrategy
Copy link

Install fails, and running php-v returns

dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /usr/local/opt/php@7.0/bin/php
  Reason: image not found

on a brand new Catalina MacBook.

I'm unsure if this is an error here, or elsewhere.

@leanormandon
Copy link

leanormandon commented Dec 3, 2019

I had the same error since I've update & upgrade brew. (to install php7.4)
Did you fix it ?

@leanormandon
Copy link

Ok I fix it, you need to install the old version of openssl, but it doesn't exist anymore on homebrew.
So I download the old formula ( here ) and I install it with brew install ./openssl.rb and it worked. 👍

@KoenPasman
Copy link

Yes, it looks like Brew deprecated openssl v1.0 in favour of v1.1.
I ran this script found here:

$ brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

And that installs openssl 1.0 and fixed my issue.

@pgrenaud
Copy link
Contributor

pgrenaud commented Dec 19, 2019

Hi!

Thanks for reporting the issue.

We got the same issue while provisioning a new laptop. And we still have not figure out how to fix it.

The solution proposed by @leanormandon works, because it is using the existing bottle from Homebrew. But if I try to rebuild the bottles (for openssl, then php@5.6), I'm unable to get a successful build for php@5.6. I even try to build php@5.6 with the same openssl version it was built one year ago, but that did not work either.

Without a successful build of php@5.6, we won't be able to provide a clean solution. If someone want to give it a try, look a the develop branch.

Regards.

EDIT: I said php@5.6 in my message while this issue is about php@7.0, but both of these formulae face the same issue.

@pgrenaud pgrenaud changed the title PHP 7.0 doesn't run on Catalina - openssl 1.0.0 needed PHP 5.6 and 7.0 doesn't run on Catalina - openssl 1.0.0 needed Dec 19, 2019
@eoswald
Copy link

eoswald commented Jan 23, 2020

I tried removing openssl v1.1 and installing the openssl v1.0 that @leanormandon linked but still run into issues:

$ /usr/local/opt/php@5.6/bin/php -v
dyld: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: /usr/local/opt/libpq/lib/libpq.5.dylib
  Reason: image not found
zsh: abort      /usr/local/opt/php@5.6/bin/php -v

Edit:
Looks like I shouldn't remove openssl v1.1. I need to keep it but change the library names using install_name_tool:

$ /usr/local/opt/php@5.6/bin/php -v
dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /usr/local/opt/php@5.6/bin/php
  Reason: image not found
zsh: abort      /usr/local/opt/php@5.6/bin/php -v

$ sudo install_name_tool -change /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/Cellar/openssl/1.0.2t/lib/libcrypto.1.0.0.dylib /usr/local/opt/php@5.6/bin/php

$ /usr/local/opt/php@5.6/bin/php -v
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/opt/php@5.6/bin/php
  Reason: image not found
zsh: abort      /usr/local/opt/php@5.6/bin/php -v

$ sudo install_name_tool -change /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/Cellar/openssl/1.0.2t/lib/libssl.1.0.0.dylib /usr/local/opt/php@5.6/bin/php

$ /usr/local/opt/php@5.6/bin/php -v
PHP 5.6.40 (cli) (built: Apr 23 2019 11:14:34)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

@metalelf0
Copy link

metalelf0 commented Jan 29, 2020

Hi @eoswald , thanks for your answer, this is a life-saver. After following your steps I'm still having trouble starting apache, though:

λ sudo apachectl restart                                                                                                                                                   
httpd: Syntax error on line 183 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/openssl/lib/libcrypto.1.0.0.dylib\n 
Referenced from: /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so\n 
 Reason: image not found

Any clue about how to fix this? Thanks again.

EDIT: solved with these two ln commands, leaving it here for others having the same issue:

λ sudo ln -s /usr/local/Cellar/openssl/1.0.2t/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
λ sudo ln -s /usr/local/Cellar/openssl/1.0.2t/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

@tholu
Copy link

tholu commented Feb 8, 2020

I put the old openssl in my tap to save you some time.

brew tap tholu/tap
brew install tholu/tap/openssl

afterwards

brew reinstall php@5.6

@jonom
Copy link

jonom commented Mar 4, 2020

Thanks all for solving this. A combination of the last two answers worked for me:

$ brew tap tholu/tap
$ brew install tholu/tap/openssl
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
$ brew reinstall php@5.6

@amichia
Copy link

amichia commented Mar 25, 2020

Thanks all for solving this. A combination of the last two answers worked for me:

$ brew tap tholu/tap
$ brew install tholu/tap/openssl
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
$ brew reinstall php@5.6

This doesnt work for me. I still get this message when get to the point of running: "$ brew reinstall php@5.6" :

Last 15 lines from /Users/amichia/Library/Logs/Homebrew/php@5.6/03.make: typedef struct rsa_st RSA; ^ /private/tmp/php@5.6-20200325-76513-ly7xd7/php-5.6.40/ext/openssl/openssl.c:3619:6: error: incomplete definition of type 'struct rsa_st' OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), rsa, d); ^ ~~~ /private/tmp/php@5.6-20200325-76513-ly7xd7/php-5.6.40/ext/openssl/openssl.c:3548:9: note: expanded from macro 'OPENSSL_PKEY_SET_BN' _type->_name = BN_bin2bn( \ ~~~~~^ /usr/local/opt/openssl@1.1/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'struct rsa_st' typedef struct rsa_st RSA; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [ext/openssl/openssl.lo] Error 1 make: *** Waiting for unfinished jobs....

Anyone that run into the same issue? I have been struggling for quiet a while. It all started when I upgraded brew. Next this, my apache and php5.6 stop working. I need this specific version of php in the project Im working in.

Btw, Im on MAC OS Sierra High

@tholu
Copy link

tholu commented Mar 25, 2020

@amichia My instructions work for me on Catalina, sorry no possibility to test High Sierra.

@amichia
Copy link

amichia commented Mar 26, 2020

Hi @tholu! No worries, I could finally solve it without brew, just installing php5.6 in one line command following this guide:

https://php-osx.liip.ch/

@MCFreddie777
Copy link

MCFreddie777 commented Apr 6, 2020

https://www.sminrana.com/php/install-php-5-6-on-macos-catalina/ Helped me - now it works.

@waqasraza123
Copy link

@eoswald saved me a lot of time. Thanks

@Muffinman
Copy link

I am still not able to get this working properly in High Sierra.

I've had a few problems trying the suggestion in @jonom #14 (comment), the major ones seem to be:

  • That tap now installs 1.0.2t instead of 1.0.2s, so had to update those symlink lines
  • php5.6 still seems to want to install openssl@1.1 as a dependency and fails to compile with the same error as @amichia PHP 5.6 and 7.0 doesn't run on Catalina - openssl 1.0.0 needed #14 (comment) had
  • After editing the php@5.6 formula to hard code the openssl 1.0.2s path I could get PHP to configure, but builds still failed.
  • curl-openssl is a requirement, but I think the problem is that this formula is compiled with openssl@1.1 and this causes some issues when PHP tries to compile

Gave up for the time being, but I think I could get it working if I hacked the curl-openssl formula in the same way and rebuilt that from source too.

@marcelloinfoweb
Copy link

marcelloinfoweb commented Apr 24, 2020

Thanks all for solving this. A combination of the last two answers worked for me:

$ brew tap tholu/tap
$ brew install tholu/tap/openssl
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
$ brew reinstall php@5.6

After this procedure, this message appears

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/opt/php@5.6/sbin/php-fpm
Reason: image not found

MacOS Catalina
PHP 5.6

@marcelloinfoweb
Copy link

marcelloinfoweb commented Apr 24, 2020

@JParkinson1991
Copy link

For eveyone interested.

php@7.0 does not require openssl 1.0.0 it can be recompiled to use 1.1

$ brew list --versions openssl
openssl@1.1 1.1.1g
$ brew reinstall --build-from-source php@7.0 

php@5.6 can be patched to compile against openssl 1.1.x.
Very useful if running other versions of PHP depending on the latest version of openssl.
Soultion: #23 (comment)

@boxxroom
Copy link

boxxroom commented Jun 16, 2020

@JParkinson1991 Thanks for the update on this.

I have come across a possible bug / issue, which I have isolated to
$ brew reinstall --build-from-source php@7.0 with "too many files open" when using MariaDB 10.4 database
error-too-many-files-open

Using a completely fresh install of OS X Catalina on MacBook Pro (Retina, 13-inch, Mid 2014), 3 GHz Dual-Core Intel Core i7, 6 GB 1600 MHz DDR3, 1TB WD Black Edition and the following brew installations:

  • Composer
  • Laravel Valet (Installs DnsMasq 2.81, Nginx 1.19.0)
  • PHP 7.4
  • PHP 7.3
  • PHP 7.0 --build-from-source
  • MariaDB 10.4

These all subsequently install additional packages (attached)
brew-list

This is the third test doing the same thing, where by I install a fresh copy of OSX Catalina and install the brew packages, each time I have install $ brew reinstall --build-from-source php@7.0 and the error occurs.

Each PHP services has been stopped prior to testing the next version with the conclusion:
PHP 7.4, PHP 7.3 shows no issues, with the ability to import/export SQL, delete tables, databases and update statements.

I understand it's possible to update the limits on OSX as they are "apparently" quite low, but from my stance this seems to be masking an issue when PHP 7.3/7.4 work with no issues. I am guessing it's something within -build-from-source that's the culprit.
ulimits

EDIT
NB: After removing PHP@7.0 brew remove PHP@7.0 || brew remove --force PHP@7.0 with a restart of the MacBook the issue persists.

I thought I would raise this a possible problem.

Please let me know your thoughts on this one.

Thanks in advance.

@JParkinson1991
Copy link

@boxxroom Given you're importing the database via Sequel Pro i dont think this has anything to do with PHP, nor do i think PHP, the version of it or the fact it was built from source is the cause of this problem.

My guess is this is a problem local to the database installation itself, in your case MariaDB. You probably need to look at configuring open_files_limit for MariaDB.

@boxxroom
Copy link

Thanks for you reply @JParkinson1991.

As mentioned previously, the issue of import, exporting, deleting of tables, databases or SQL statements does not have any issues on PHP7.3/PHP7.4. I might also add (which I had forgotten) this is when PHP7.0 hasn't been installed otherwise using PHP7.+ has the same effect.

Sequel Pro or Terminal it doesn't matter the issue / error output is still the same.

Why would this error only occur with the installation of PHP7.0?

Again, like I mentioned I understand you can increase the limits of OS X but this seems like masking the issue, why would the error not occur on PHP7.3/PHP7.4 (without PHP7.0 installed).

I am curious.

I would like to say, either way - I really appreciate and respect you taking the time to patch PHP7.0 to work on new OSX version.

@auminfoway
Copy link

For eveyone interested.

php@7.0 does not require openssl 1.0.0 it can be recompiled to use 1.1

$ brew list --versions openssl
openssl@1.1 1.1.1g
$ brew reinstall --build-from-source php@7.0 

php@5.6 can be patched to compile against openssl 1.1.x.
Very useful if running other versions of PHP depending on the latest version of openssl.
Soultion: #23 (comment)

Amazing, sort & sweet solution, spent two days for this solution.

@shivammathur
Copy link

shivammathur commented Sep 11, 2020

I maintain a homebrew tap with PHP 5.6 to a nightly build of PHP 8.1.
https://github.com/shivammathur/homebrew-php

PHP 5.6 and PHP 7.0 have been rebuilt to use openssl@1.1 and all formulae are regularly updated for libraries so you will not need to reinstall or install from source.

@ammmze
Copy link

ammmze commented Nov 11, 2020

I maintain a homebrew tap with PHP 5.6 to a nightly build of PHP 8.1.
https://github.com/shivammathur/homebrew-php

PHP 5.6 and PHP 7.0 have been rebuilt to use openssl@1.1 and all formulae are regularly updated for libraries so you will not need to reinstall or install from source.

@shivammathur ++++++++ Thank you for all that! I've been struggling to find an easy way to document for other developers I work with to get the correct (but old...5.6...yuck) version of PHP installed.

@CloudyCity
Copy link

CloudyCity commented Nov 13, 2020

Thanks all for solving this. A combination of the last two answers worked for me:

$ brew tap tholu/tap
$ brew install tholu/tap/openssl
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
$ sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
$ brew reinstall php@5.6

After this procedure, this message appears

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/opt/php@5.6/sbin/php-fpm
Reason: image not found

MacOS Catalina
PHP 5.6

I forked @tholu 's tap and add icu4c@64.2.

$ brew tap cloudycity/tap
$ brew install icu4c@64.2
$ sudo ln -s /usr/local/opt/icu4c@64.2/lib/libicudata.64.dylib /usr/local/opt/icu4c/lib/libicudata.64.dylib
$ sudo ln -s /usr/local/opt/icu4c@64.2/lib/libicui18n.64.dylib /usr/local/opt/icu4c/lib/libicui18n.64.dylib
$ sudo ln -s /usr/local/opt/icu4c@64.2/lib/libicuuc.64.dylib /usr/local/opt/icu4c/lib/libicuuc.64.dylib
$ sudo ln -s /usr/local/opt/icu4c@64.2/lib/libicuio.64.dylib /usr/local/opt/icu4c/lib/libicuio.64.dylib

But i think @shivammathur 's resolution is the best.

Updated
You can using tholu/tap to install icu4c@64.2 now.

@tholu
Copy link

tholu commented Nov 13, 2020

@CloudyCity If you provide a pull request, I'll happily accept it in my tap. However, I also think that @shivammathur is the best right now - thanks a lot!

@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