Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php@7.4 no longer works after icu4c 72 upgrade #120854

Closed
3 tasks done
Groxx opened this issue Jan 17, 2023 · 12 comments
Closed
3 tasks done

php@7.4 no longer works after icu4c 72 upgrade #120854

Groxx opened this issue Jan 17, 2023 · 12 comments
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@Groxx
Copy link

Groxx commented Jan 17, 2023

brew gist-logs <formula> link OR brew config AND brew doctor output

❯ brew config
HOMEBREW_VERSION: 3.6.19
ORIGIN: https://github.com/Homebrew/brew
HEAD: 3e257890da96b4cc44f5933e3a54aee2b47549de
Last commit: 4 days ago
Branch: stable
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 133f8e9ee6291768b732402f7631338a78cf7bca
Core tap last commit: 39 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.drDqMhsndb/org.xquartz:0
HOMEBREW_EDITOR: vim
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.39.0 => /opt/homebrew/bin/git
Curl: 7.85.0 => /usr/bin/curl
macOS: 13.1-arm64
CLT: 14.2.0.0.1.1668646533
Xcode: 14.2
Rosetta 2: false
❯ 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: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  php@7.4

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libcrypto.1.1.dylib
  /usr/local/lib/libevent-2.1.7.dylib
  /usr/local/lib/libgflags.2.2.dylib
  /usr/local/lib/libglog.0.dylib
  /usr/local/lib/liblz4.1.dylib
  /usr/local/lib/libpcre.1.dylib
  /usr/local/lib/libsodium.23.dylib
  /usr/local/lib/libssl.1.1.dylib
  /usr/local/lib/libz.1.dylib
  /usr/local/lib/libzstd.1.dylib

Verification

  • My "brew doctor output" says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

Install and use php@7.4.rb with only these changes so it can be installed and linked (we maintain a fork for this formula):

❯ diff actual_php@7.4.rb custom_php@7.4.rb
25,27c21,27
<   keg_only :versioned_formula
<
<   disable! date: "2022-11-28", because: :versioned_formula
---
>   # Disabled keg only so it links
>   # src: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php@7.4.rb
>   # permalink: https://github.com/Homebrew/homebrew-core/blob/9b06fea87972f3bc4f59ceba08436be6d3fc87eb/Formula/php%407.4.rb
>   # keg_only :versioned_formula
>   #
>   # And also removing `disable!` because it will prevent installation in the future
>   # disable! date: "2022-11-28", because: :versioned_formula

What happened (include all command output)?

The latest PHP 8 works as it links against icu4c v72:

Load command 43
          cmd LC_LOAD_DYLIB
      cmdsize 72
         name /opt/homebrew/opt/icu4c/lib/libicuio.72.dylib (offset 24)
   time stamp 2 Wed Dec 31 18:00:02 1969
      current version 72.1.0
compatibility version 72.0.0

but PHP 7.4 still links to icu4c 71:

Load command 43
          cmd LC_LOAD_DYLIB
      cmdsize 72
         name /opt/homebrew/opt/icu4c/lib/libicuio.71.dylib (offset 24)
   time stamp 2 Wed Dec 31 18:00:02 1969
      current version 71.1.0
compatibility version 71.0.0

which results in the install failing:

❯ brew install php@7.4.rb
Error: Failed to load cask: php@7.4.rb
Cask 'php@7.4' is unreadable: wrong constant name #<Class:0x00000001250bd698>
Warning: Treating php@7.4.rb as a formula.
==> Fetching php@7.4
==> Downloading https://ghcr.io/v2/homebrew/core/php/7.4/manifests/7.4.33
Already downloaded: /Users/stevenl/Library/Caches/Homebrew/downloads/d90b3d05a3c2ebb5828740b4b52b1b8bdd280b90c64624f2b836b5ece3ddb3ed--php@7.4-7.4.33.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/php/7.4/blobs/sha256:1091e8f56900b00831b83fd306b5cf65c81010934291bfc123
Already downloaded: /Users/stevenl/Library/Caches/Homebrew/downloads/af452a2fb02aa3819542f97f42ee964dcad79bba6e738c29d8b9b783582f50d2--php@7.4--7.4.33.arm64_ventura.bottle.tar.gz
==> Pouring php@7.4--7.4.33.arm64_ventura.bottle.tar.gz
==> /opt/homebrew/Cellar/php@7.4/7.4.33/bin/pear config-set php_ini /opt/homebrew/etc/php/7.4/php.ini system
Last 15 lines from /Users/stevenl/Library/Logs/Homebrew/php@7.4/post_install.01.pear:
2023-01-17 17:44:50 -0600

/opt/homebrew/Cellar/php@7.4/7.4.33/bin/pear
config-set
php_ini
/opt/homebrew/etc/php/7.4/php.ini
system

dyld[79498]: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicuio.71.dylib
  Referenced from: <C417215B-8887-3615-9F1C-1DF704465A12> /opt/homebrew/Cellar/php@7.4/7.4.33/bin/php
  Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicuio.71.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicuio.71.dylib' (no such file), '/opt/homebrew/opt/icu4c/lib/libicuio.71.dylib' (no such file), '/usr/local/lib/libicuio.71.dylib' (no such file), '/usr/lib/libicuio.71.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.71.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.71.dylib' (no such file), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.71.dylib' (no such file), '/usr/local/lib/libicuio.71.dylib' (no such file), '/usr/lib/libicuio.71.dylib' (no such file, not in dyld cache)
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall php@7.4
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /opt/homebrew/opt/php@7.4/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        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:
    /opt/homebrew/etc/php/7.4/

To restart php@7.4 after an upgrade:
  brew services restart php@7.4
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/php@7.4/sbin/php-fpm --nodaemonize
==> Summary
🍺  /opt/homebrew/Cellar/php@7.4/7.4.33: 498 files, 72.8MB
==> Running `brew cleanup php@7.4`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/stevenl/Library/Caches/Homebrew/php@7.4--7.4.30_1... (17.9MB)

brew install php@7.4.rb -s works with 72 on arc output at least, seems like it probably just needs a new build to be pushed.

What did you expect to happen?

working install of 7.4

Step-by-step reproduction instructions (by running brew commands)

Apply this patch to the latest php@7.4(.33):

❯ diff actual_php@7.4.rb custom_php@7.4.rb
25,27c21,27
<   keg_only :versioned_formula
<
<   disable! date: "2022-11-28", because: :versioned_formula
---
>   # Disabled keg only so it links
>   # src: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php@7.4.rb
>   # permalink: https://github.com/Homebrew/homebrew-core/blob/9b06fea87972f3bc4f59ceba08436be6d3fc87eb/Formula/php%407.4.rb
>   # keg_only :versioned_formula
>   #
>   # And also removing `disable!` because it will prevent installation in the future
>   # disable! date: "2022-11-28", because: :versioned_formula

and install it:

brew reinstall php@7.4.rb
@Groxx Groxx added the bug Reproducible Homebrew/homebrew-core bug label Jan 17, 2023
@Groxx
Copy link
Author

Groxx commented Jan 17, 2023

Apologies, but I'm not familiar with how to request "please rebuild and push formula X now that a dependency has changed", and I couldn't find it in discussions or other issues from a bit of searching.

Hopefully this is sufficient? If not, I'm happy to change the request.

@gromgit
Copy link
Member

gromgit commented Jan 18, 2023

Not a maintainer, but "disabled on Homebrew core" means no one can install it any longer from Homebrew core, so I'm pretty sure the maintainers aren't entertaining any rebottling requests for this.

Your fork means you're responsible for maintaining it going forward.

@Groxx
Copy link
Author

Groxx commented Jan 18, 2023

Broadly I agree... but it is still in core, and it still receives updates, many times long after it was versioned and disabled. If it's unsupported it should probably be removed, in favor of a tap or something.

Also I'm honestly not sure how to add versioning to icu4c to properly manage this (I would prefer to link it against a keg-only old ICU and just freeze everything until we can drop php7), as it fails on the bottle manifest request. From some diving around docs, I get the impression that this is a rather large knowledge cliff and I'm not even sure where to start climbing - nearly all docs assume it's a core formula.

@gromgit
Copy link
Member

gromgit commented Jan 18, 2023

Broadly I agree... but it is still in core, and it still receives updates, many times long after it was versioned and disabled. If it's unsupported it should probably be removed, in favor of a tap or something.

It's disabled because upstream no longer releases updates: https://www.php.net/supported-versions.php.

I believe current policy is to permanently delete disabled formulae one year after, to give people time to copy the formula over to their own taps. At least one person is actively doing so: https://github.com/shivammathur/homebrew-php

Also I'm honestly not sure how to add versioning to icu4c to properly manage this (I would prefer to link it against a keg-only old ICU and just freeze everything until we can drop php7), as it fails on the bottle manifest request. From some diving around docs, I get the impression that this is a rather large knowledge cliff and I'm not even sure where to start climbing - nearly all docs assume it's a core formula.

The simplest way forward, assuming you don't want to rely on Shivam's own efforts, is to remove the bottle do ... end block from your formula, build from source (which, if you change nothing else, will be against the latest Homebrew dependencies)...and rebuild as necessary against new dependencies, when you see breakage like this.

@SMillerDev SMillerDev closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
@SMillerDev
Copy link
Member

PHP 7.4 is unsupported so we don't rebottle it for dependencies anymore

@Groxx
Copy link
Author

Groxx commented Jan 18, 2023

Yep, rebuilding from source does work. It's a fine though slow workaround for now.

Thanks all! I'll figure something out.

@virk
Copy link

virk commented Jan 18, 2023

@Groxx: Perhaps I had a similar problem. Have a mac mini late 2014 with Monterey and homebrew with php@7.4 (webserver). Yesterday I did "brew upgrade" and did not expect any problem. Afterwords php@7.4 did no longer work. Similar warning as you described. What I finally did is:

  • From TimeMachine I copied back the icu4c-71.1-directory. Now both 72.1 and 71.1 are stored parallel.
  • Adjusted the permissions of the 71.1 directory and content (do not know whether this was necessary)
  • Renamed the symlink which points to 72.1
  • Created at new symlink which points to 71.1 and moved it to the same location as other symlink
  • Restarted apache and it works again.
  • I write this from my mind and I am not in the office yet. Should more info be required somebody let me know.

I know I have a slightly damaged brew-installation now. I will investigate what I will do to fix it. The mac mini is only a fall-back-device, so there is some time hopefully.

Kind regards from Aachen, Germany

@SMillerDev
Copy link
Member

The better fix would be to install from https://github.com/shivammathur/homebrew-php who still supports versions of php that upstream doesn't.

@virk
Copy link

virk commented Jan 18, 2023

If I was meant, I did not touch my installed php at all, I think. Only the webserver apache couldn't start due to php@7.4 did not find icu4c@71.1, because it was overwritten by the brew upgrade command.
(But frankly speaking IT-stuff is just something I do as an absolute amateur and I am not an expert at all)

I think as soon as I delete the created symlink, renamed the original one to its original name the homebrew-installation is valid again.

@billabel
Copy link

brew upgrade shivammathur/php/php@7.4 upgrades PHP to v7.4.33_1 and fixes the issue with icu4c v72

Thanks @SMillerDev and others above for pointing out the right way to solve this problem.

@virk
Copy link

virk commented Jan 24, 2023

I just applied the following on an Apple M1 Macbook Pro with Ventura 13.2:

Heiner@virk Release % brew tap shivammathur/php
Heiner@virk Release % brew upgrade shivammathur/php/php@7.4
Heiner@virk Release % codesign --remove-signature /opt/homebrew/Cellar/php@7.4/7.4.33_1/lib/httpd/modules/libphp7.so
Heiner@virk Release % codesign -s "Veelken_20220228" --keychain ~/Library/Keychains/login.keychain-db /opt/homebrew/Cellar/php@7.4/7.4.33_1/lib/httpd/modules/libphp7.so

Now it seems as if php@7.4 and php@8.1 both can work with icu4c 72.1.
Questions:

  1. Is the homebrew-installation still valid/correct or is it corrupted now somehow?
  2. Did the "upgrade" only update the existing homebrew-php@7.4-version or did it install a completely new one?
  3. Why did I need to apply the "brew tap shivammathur/php"?
  4. Is there anything else I need to take care of concerning this matter?

@qthrustofficial
Copy link

Thank you @virk It worked like a charm.

@github-actions github-actions bot added the outdated PR was locked due to age label Mar 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

6 participants