Error when install PHP with brew in OS Monterey - php

I got php is deleted in OS Monterey, so I try to install it via Homebrew
I already install Homebrew, update tap to shivammathur/php and use this command
brew install shivammathur/php/php#7.4
but I got this response code
fatal: Could not resolve HEAD to a revision
Warning: No available formula with the name "httpd" (dependency of shivammathur/php/php#7.4).
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
When I check brew version with brew --version I got this info
Homebrew 3.3.2
Homebrew/homebrew-core (no Git repository)
Homebrew/homebrew-cask (git revision 5c43c2133d; last commit 2021-11-06)
is that no Git repository issue related with why I cant install php in my device? How to solve this issue
I need this to install composer and install Laravel, so install XAMPP I think is not clear solution right now
Thankyou

I recently had this exact problem and tried
brew tap homebrew/core
However, it didn't work. This did work for me
rm -rf $(brew --repo homebrew/core)
brew tap homebrew/core
brew install php
Hope this helps!

As the output of brew --version says homebrew-core repository is missing, that is why brew is not able to find httpd.
Homebrew/homebrew-core (no Git repository)
Please tap the core repository and try again.
brew tap homebrew/core

Try write this in terminal:
git -C $(brew --repository homebrew/core) checkout master

Related

Homebrew: How install disabled package(php7.1)?

I try to install php7.1 (via command brew install php#7.1) for my work-project on my new macbook, but i got following message:
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
I can't reject using php7.1 because it requirement of my work.
How can I install php7.1 on MacOS?
Start by making sure brew is up-to-date:
brew update
Normal upgrade
brew upgrade PHP
Normal upgrade does not work in many macOS old Versions.
Upgrade with shivammathur/homebrew-php
brew tap shivammathur/php
brew install shivammathur/php/php#7.1
To switch between versions, use the following command:
brew link --overwrite --force php#7.1
Next steps
Check the current version by running php -v:
If you can then, Restart Nginx or Apache also:
refer Link

Homebrew upgrade drops PHP: dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib

Today I upgraded Homebrew and this causes PHP versions (7.2 - 7.3) to be dropped. the following error is shown whenever I try to reinstall them:
dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib
Referenced from: /usr/local/opt/curl-openssl/bin/curl
Reason: image not found
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "php"
Download failed: https://www.php.net/distributions/php-7.3.9.tar.xz
Any suggestions?
Okay, I've solved this by installing this library brew install libpsl
then reinstall php brew reinstall php#7.2 --build-from-source
also the same for php#7.3
Be aware that reinstalling php will reset all php configurations
It's a bug after php was migrated to OpenSSH 1.1. There's no need to install libpsl.
The problem has been fixed by pr-44048. You should uninstall libpsl and reinstall php.
brew uninstall libpsl
brew reinstall php
Removing the Cellar folder and installing the PHP again worked for me.
rm -rf /Users/rafaelgomes/.composer/*
rm -rf /usr/local/Cellar/*
brew doctor ; brew update ; brew upgrade
brew install php
I've solved this by doing the following
brew uninstall libpsl
brew remove php
brew install libpsl
brew install php#8.0

Homebrew PHP appears not to be linked. - Valet

I had a problem which appeared all of the sudden saying:
Unable to determine linked PHP. which I could not solve so I uninstalled valet, php and dependencies. Then I installed fresh php7.1 but when I run valet install I get quiet slightly similar error: Homebrew PHP appears not to be linked.
First, find the PHP version installed via.
brew list
In my case it was php#7.3, then
brew link php#7.3 --force --overwrite
and finally
valet install
:)
Homebrew can't find the correct PHP version, have you linked them up properly?
brew link php71
brew link php#7.2 --force --overwrite
That will push this--
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/php#7.2/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.2/sbin:$PATH"' >> ~/.bash_profile
I ran both independently then tried valet install (worked like a charm).
brew install php#7.1
then link it
brew link php#7.1 --force --overwrite
$ brew unlink php && brew link --force php#7.1
If you are coming here following a migration from Intel to M1 and having Valet not use the php cask from the /opt/ folder, this did the trick for me:
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zshrc.

PHP 7.1 install with Homebrew - error running brew tap homebrew/homebrew-php

I'm trying to install PHP 7.1 on my Mac using Brew. I do not have any version of PHP other than what Apple installs as default.
I've run the following commands (based on various posts) to install PHP 7.1:
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
When I run the brew tap for homebrew-php I get the following messages (copied from terminal). Can anyone suggest what I need to do?
brew tap homebrew/homebrew-php
==> Tapping homebrew/php
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-php'...
remote: Counting objects: 757, done.
remote: Compressing objects: 100% (512/512), done.
remote: Total 757 (delta 505), reused 305 (delta 236), pack-reused 0
Receiving objects: 100% (757/757), 306.08 KiB | 0 bytes/s, done.
Resolving deltas: 100% (505/505), done.
Checking out files: 100% (748/748), done.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Formula/deployer.rb
invalid attribute for formula 'homebrew/php/deployer': version (nil)
Error: Cannot tap homebrew/php: invalid syntax in tap!
You can try:
brew search php7
A list of available php extensions will be listed to you.
To install php7.1 you can use:
brew install homebrew/php/php71
I realized I needed to add homebrew/php to my repositories then I was able to run brew install homebrew/php/php71 and it worked. I have to wonder if I might had a typo. Either way, it installed a bunch of dependencies and it just worked.

brew install php55-intl fails, Cant Install Composer

I'm trying to install npm install && grunt, however it tells me that I need composer. I'm trying to install composer but that's dependent on php55.
I've tried brew install php55, php55-intl, php56, php56-intl, etc.
I am reading the instructions from here: https://getcomposer.org/doc/00-intro.md
It states that for a Mac I should simply use brew commands:
brew update brew tap
homebrew/homebrew-php
brew tap homebrew/dupes
brew tap homebrew/versions
brew install php55-intl #fails here
brew install homebrew/php/composer
I am getting the following error:
brew install php55-intl
==> Installing dependencies for php55-intl: php55, icu4c
==> Installing php55-intl dependency: php55
==> Downloading http://www.php.net/get/php-5.5.15.tar.bz2/from/this/mirror Already
downloaded: /Library/Caches/Homebrew/php55-5.5.15
==> ./configure --prefix=/usr/local/Cellar/php55/5.5.15 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.5 --with-config-file-path=/usr/local/etc/php/5.5 --with-config-file-scan-dir=/usr/local/etc/php/5.5/conf.d -- checking for png_write_image in -lpng... yes If configure fails try
--with-xpm-dir= checking for fabsf... yes checking for floorf... yes configure: error: GD build test failed. Please check the
config.log for details.
READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
https://github.com/homebrew/homebrew-php/issues
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require': Class is not a module (TypeError) from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:390:in
<class:HTTP>' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:384:in
' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:25:in
<top (required)>' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/https.rb:21:in
' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
require' from /usr/local/Library/Homebrew/utils.rb:308:in open'
from /usr/local/Library/Homebrew/utils.rb:350:inissues_matching'
from /usr/local/Library/Homebrew/utils.rb:378:in issues_for_formula'
from /usr/local/Library/Homebrew/exceptions.rb:171:infetch_issues'
from /usr/local/Library/Homebrew/exceptions.rb:167:in issues' from
/usr/local/Library/Homebrew/exceptions.rb:207:indump' from
/usr/local/Library/brew.rb:158:in rescue in <main>' from
/usr/local/Library/brew.rb:66:in'
Does anyone know another work around? I've tried curl commands but they never run, and I can't run the exe on my mac.
Thanks!
Solution:
Upgrade to the latest version of XCode
Make sure you reinstall XCode CLT: xcode-select --install
Update your formulae: brew update
Remove zlib: brew rm zlib
Install / reinstall php55: brew install php55 (as zlib is a dependency, it will be reinstalled)
Followed by brew install composer
Found here: https://github.com/Homebrew/homebrew-php/issues/610
I needed to update my Xcode, and then everything ran.

Categories