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

Error zsh: killed on work on Big sur 11.2.3

samsonasik opened this issue ยท comments

Describe the bug

After updated to Big Sur 11.2.3, it got error:

% php -v
zsh: killed     /opt/homebrew/bin/php -v

PHP versions
8.0, 7.4

To Reproduce

Update to Big Sur 11.2.3, run it, even uninstall and reinstall it.

Expected behavior

Working.

Screenshots/Logs

Screen Shot 2021-03-09 at 15 47 01

Additional context

On Mac Mini M1 8Gb/512

I will update my M1 CI machine, test and check.

Thank you ๐Ÿ‘

I had the same issue, and after some research, I found that the install process try to write in /usr/lib/php/extensions but with the std rights, you can't write anything in it.
Maybe the soluce is to install extensions in a Cellar directory ?

@thibmonier The formula only writes to homebrew prefix, so /usr/local on intel and /opt/homebrew on M1
The extension directory should be /usr/local/lib/php/pecl/... on intel and /opt/homebrew/lib/php/pecl/... on M1.

Both /opt/homebrew and /usr/local are not under system integrity protection. So that should not be the issue.

@samsonasik
I have updated my CI machine and the tap works without any issues.
https://github.com/shivammathur/test-setup-php/actions/runs/635499537/workflow

Please uninstall the php version.
Run xcode-select --install to update the cli tools and install php again.
Let me know if that fixes it.

I already uninstall the per-php version, re-run xcode-select --install, and re-install shivammathur/php/php@7.4, it seems still not working:

samsonasik@Abduls-Mac-mini ~ % brew uninstall shivammathur/php/php@7.4
Error: No available formula or cask with the name "shivammathur/php/php@7.4".
samsonasik@Abduls-Mac-mini ~ % xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
samsonasik@Abduls-Mac-mini ~ % brew tap shivammathur/php
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 10 formulae.

samsonasik@Abduls-Mac-mini ~ % brew install shivammathur/php/php@7.4
==> Installing php@7.4 from shivammathur/php
==> Downloading https://dl.bintray.com/shivammathur/php/php%407.4-7.4.16.arm64_big_sur.bottle.tar.gz
Already downloaded: /Users/samsonasik/Library/Caches/Homebrew/downloads/3ac70825a21a8eacbfadb5633a86a870c0b32d89f5f82a9d06ec7e1961bcd896--php@7.4-7.4.16.arm64_big_sur.bottle.tar.gz
==> Pouring php@7.4-7.4.16.arm64_big_sur.bottle.tar.gz
==> /opt/homebrew/Cellar/php@7.4/7.4.16/bin/pear config-set php_ini /opt/homebrew/etc/php/7.4/php.ini system
Last 15 lines from /Users/samsonasik/Library/Logs/Homebrew/php@7.4/post_install.01.pear:
2021-03-09 17:59:59 +0700

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

Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall shivammathur/php/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/

php@7.4 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have php@7.4 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc

For compilers to find php@7.4 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/php@7.4/include"


To have launchd start shivammathur/php/php@7.4 now and restart at login:
  brew services start shivammathur/php/php@7.4
Or, if you don't want/need a background service you can just run:
  php-fpm
==> Summary
๐Ÿบ  /opt/homebrew/Cellar/php@7.4/7.4.16: 497 files, 73MB
samsonasik@Abduls-Mac-mini ~ % brew link --overwrite --force php@7.4
Linking /opt/homebrew/Cellar/php@7.4/7.4.16... 25 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
  
samsonasik@Abduls-Mac-mini ~ % php -v
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies

samsonasik@Abduls-Mac-mini ~ % echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
samsonasik@Abduls-Mac-mini ~ % echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc

samsonasik@Abduls-Mac-mini ~ % source ~/.zshrc 
samsonasik@Abduls-Mac-mini ~ % php -v            
zsh: killed     php -v

Remove cli tools first and install again to get the latest version

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Run brew config to check the version.

Then reinstall php, if you get the same error, let me know the output of this for php 7.4

brew postinstall shivammathur/php/php@7.4

After installing and linking php, restart terminal before checking php version, so that you do not get "WARNING: PHP is not recommended" warning.

Here is the output of remove, reinstall, run brew config:

samsonasik@Abduls-Mac-mini ~ % sudo rm -rf /Library/Developer/CommandLineTools
Password:

samsonasik@Abduls-Mac-mini ~ % xcode-select --install
xcode-select: note: install requested for command line developer tools

samsonasik@Abduls-Mac-mini ~ % brew config
HOMEBREW_VERSION: 3.0.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: ee52b19179d056f3dd2fdf9c52214d3d51dbb9d9
Last commit: 7 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: dbe01165ab730071d0da276649562308b3928e0d
Core tap last commit: 79 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1200
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.2.3-arm64
CLT: 12.4.0.0.1.1610135815
Xcode: 12.4
Rosetta 2: false

samsonasik@Abduls-Mac-mini ~ % brew tap shivammathur/php

samsonasik@Abduls-Mac-mini ~ % brew install shivammathur/php/php@7.4
==> Installing php@7.4 from shivammathur/php
==> Downloading https://dl.bintray.com/shivammathur/php/php%407.4-7.4.16.arm64_big_sur.bottle.tar.gz
Already downloaded: /Users/samsonasik/Library/Caches/Homebrew/downloads/3ac70825a21a8eacbfadb5633a86a870c0b32d89f5f82a9d06ec7e1961bcd896--php@7.4-7.4.16.arm64_big_sur.bottle.tar.gz
==> Pouring php@7.4-7.4.16.arm64_big_sur.bottle.tar.gz
==> /opt/homebrew/Cellar/php@7.4/7.4.16/bin/pear config-set php_ini /opt/homebrew/etc/php/7.4/php.ini system
Last 15 lines from /Users/samsonasik/Library/Logs/Homebrew/php@7.4/post_install.01.pear:
2021-03-09 18:46:04 +0700

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

Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall shivammathur/php/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/

php@7.4 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have php@7.4 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc

For compilers to find php@7.4 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/php@7.4/include"


To have launchd start shivammathur/php/php@7.4 now and restart at login:
  brew services start shivammathur/php/php@7.4
Or, if you don't want/need a background service you can just run:
  php-fpm
==> Summary
๐Ÿบ  /opt/homebrew/Cellar/php@7.4/7.4.16: 497 files, 73MB

samsonasik@Abduls-Mac-mini ~ % brew link --overwrite --force php@7.4
Linking /opt/homebrew/Cellar/php@7.4/7.4.16... 25 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
  
samsonasik@Abduls-Mac-mini ~ % php -v
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:22) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies

Close and re-open terminal, still error:

samsonasik@Abduls-Mac-mini ~ % php -v
zsh: killed     php -v

Here is the output of postinstall:

brew postinstall shivammathur/php/php@7.4
==> Postinstalling php@7.4
==> /opt/homebrew/Cellar/php@7.4/7.4.16/bin/pear config-set php_ini /opt/homebrew/etc/php/7.4/php.ini system
Last 15 lines from /Users/samsonasik/Library/Logs/Homebrew/php@7.4/post_install.01.pear:
2021-03-09 18:47:42 +0700

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

Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall shivammathur/php/php@7.4

ok, it seems the permissions in your brew setup may not be correct, since it is unable to write to the pear config file.

sudo chown -R "$(id -un)":"$(id -gn)" /opt/homebrew

Then reinstall php along with its dependencies.

brew reinstall $(brew deps shivammathur/php/php@7.4) shivammathur/php/php@7.4

Restart terminal and test

@shivammathur it works ๐ŸŽ‰ , thank you

php -v
PHP 7.4.16 (cli) (built: Mar  4 2021 16:12:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

should readme.md to be updated with troubleshooting for it?

Cool, I will update the readme