I'm using PHP 7.2.3 installed using homebrew, and I want to install PostgreSQL driver for my PHP.
I tried to search the driver using homebrew search
jeremy#mbp ~ brew search php72-pdo-pgsql
==> Searching local taps...
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
No formula found for "php72-pdo-pgsql".
Closed pull requests:
enchant 2.2.0 (https://github.com/Homebrew/homebrew-core/pull/21807)
Add PHP 7.2.0-alpha.1 core formula (php72) (https://github.com/Homebrew/homebrew-php/pull/4211)
I tried brew update && brew upgrade but I still can't find the PostgreSQL driver for my version of PHP.
Also, I tried to search only with brew search pgsql, but none of the results is for my PHP version.
Here's my brew tap results
jeremy#mbp ~ brew tap
caskroom/cask
heroku/brew
homebrew/core
homebrew/dupes
homebrew/php
homebrew/services
And my brew version
jeremy#mbp ~ brew -v
Homebrew 1.5.10
Homebrew/homebrew-core (git revision c3a9a; last commit 2018-03-17)
Since php72 that is included in the package. So if you do now
brew install php you will get that included. Reference: https://github.com/Homebrew/homebrew-php/commit/8771c68f3ddfee62d9e97177449010c2968f91d1#commitcomment-27883803
Related
I made the seemingly bad decision to update to macOS Monterey 12.3.1, and am having a hell of a time trying to get PHP working on it again. From what I've seen, Apple has decided that PHP is deprecated - at least from their machines, and they removed every php version and setting that I had set up for all my Laravel and Wordpress projects!
I tried reinstalling PHP using homebrew but I got a lot of errors about certain packages not being able to be downloaded due to authorization denial?
So then I attempted to uninstall and reinstall Homebrew, and I did the following:
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Add the following to zshrc
eval "$(/opt/homebrew/bin/brew shellenv)"
Test brew version to see if it's working
brew --version
Run brew doctor to make sure everything is configured correctly
brew doctor
I also saw that it was likely that there would be libraries missing and that i should reinstall open ssl so i did that as well:
brew install openssl
Then for PHP I ran:
brew tap shivammathur/php
and then
brew install shivammathur/php/php#7.4
brew install shivammathur/php/php#8.0
and I even restarted the php services just in case
brew services restart shivammathur/php/php#7.4
brew services restart shivammathur/php/php#8.0
Then I ran
php -v
and I got the following error:
zsh: command not found: php
and which php says php not found
what the heck!
I then tried to unlink php and force a link to 7.4:
brew unlink php && brew link --overwrite --force php#7.4
and I got the following brew error:
Error: No such keg: /usr/local/Cellar/php
I tried digging into fixing this keg issue but i haven't been able to figure it out, do you have any suggestions on next steps
Check that Homebrew's bin directory i.e. $(brew --prefix)/bin is in your PATH.
If you want to link PHP 7.4, run
brew link --overwrite --force php#7.4
If you get an error mentioning that it is already linked, you can relink it by unlinking it first and linking it again to be sure. Make sure you unlink the correct version.
brew unlink php#7.4
brew link --overwrite --force php#7.4
I refered to some tutorials in google, but they do not work, I guess those methods are outdated.
eg https://developerjack.com/blog/2016/installing-php71-with-homebrew/
I got error when I run "brew install php#7.1"
macOS Catalina 10.15.4
executed
brew install
brew tap
caskroom/cask
homebrew/bundle
homebrew/cask
homebrew/core
homebrew/services
mongodb/brew
brew -v
Homebrew 2.2.12
Homebrew/homebrew-core (git revision 53ccd; last commit 2020-04-08)
Homebrew/homebrew-cask (git revision 322a2; last commit 2020-04-08)
brew install php#7.1
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.
Error: No available formula with the name "php#7.1"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Up until the end of March 2018, all PHP related brews were handled by Homebrew/php tab, but that has been deprecated, so now we use what's available in the Homebrew/core package. This should be a better maintained, but is a much less complete, set of packages.
PHP 5.6, PHP 7.0, and PHP 7.1 have been deprecated and removed from Brew because they are out of support, and while it's not recommended for production, there are legitimate reasons to test these unsupported versions in a development environment.
Remember only PHP 7.2 through 7.4 are officially supported by Brew so if you want to install PHP 5.6, PHP 7.0, or PHP 7.1 you will need to add this tap:
$ brew tap shivammathur/php
Reference here
PHP#7.1 is deprecated https://www.php.net/supported-versions.php.
So try to install with other repo
brew install openldap libiconv
brew tap exolnet/homebrew-deprecated
brew install php#7.1
https://devhoi.com/threads/install-brew-deprecated-php-version-php-7-1-5-6-7-0-on-brew-macos.25/
I have been trying to install pcntl extension using homebrew in MacOS High sierra using command
brew install homebrew/php/php71-pcntl
brew install homebrew-php/php71-pcntl
Also tried with php54, 55, 56, 70
I m getting error
Updating Homebrew...
Error: No available formula with the name "homebrew/php/php7-pcntl"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/php is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/php)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
Why its not finding the formulae on my Mac I have php 7.1.14 on my mac
In February and March 2018 the PHP formulas for the currently supported PHP versions (5.6, 7.0, 7.1, 7.2 at the moment of this writing) were moved to the core Homebrew tap and in April 2018 the PHP tap has been archived.
To install the current PHP version (7.2) use:
$ brew install php
To install one of the other supported versions use:
$ brew install php#5.6
(replace 5.6 with 7.0 or 7.1 for the other versions).
All the formulas installed this way contain the pcntl extension, there is no need for anything else.
today I've update Brew and now I can't install the php56-extensions.
On my Mac is installed "php56" and today I had need to install, "php56-redis", but when I had try to install this extension, Brew returned the following error message.
$ brew install php56-redis
Error: No available formula with the name "php56-redis"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
I see on homebrew/php page that this "tap" is deprecated and for now only PHP engine are migrated on php#5.6 but the extensions not works.
First install exolnet/homebrew-deprecated
$ brew tap exolnet/homebrew-deprecated
After it install deprecated package
$ brew install php#5.6
I've found a solution to use old version of homebrew/php on my Mac.
Step 1
Go to last valid release of homebrew/php for php56
https://github.com/Homebrew/homebrew-php/tree/966f6c318be2d80b4953cd8cdc112b9611eff8d9
and download the Zip file.
homebrew-php-966f6c318be2d80b4953cd8cdc112b9611eff8d9.zip
Step 2
Go to
/usr/local/Homebrew/Library/Taps/homebrew/
and rename the Tap
homebrew-php
in
old-homebrew-php
Step 3
Unzip
homebrew-php-966f6c318be2d80b4953cd8cdc112b9611eff8d9.zip
in
/usr/local/Homebrew/Library/Taps/homebrew/
and rename folder in
homebrew-php
Step 4
Search your php extension with brew:
$ brew search php56-redis
==> Searching local taps...
homebrew/php/php56-redis
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
Step 5
Install pakages without updates:
HOMEBREW_NO_AUTO_UPDATE=1 brew install homebrew/php/<formula>
This will stop the homebrew update for this command. If you want to prevent auto update for your shell session, use:
export HOMEBREW_NO_AUTO_UPDATE=1
to set it permanently, add it to your ~/.bash_profile.
Now at 2022, I only found https://github.com/shivammathur/homebrew-php to be still working.
See Error while doing `brew tap exolnet/homebrew-deprecated`
EDIT:
As it turned out, that you might also need legacy mysql 5.7 together with the ancient php, I ended up using lando (based on docker) to get it up running. This is my .lando.yml:
name: app
recipe: drupal6 # pulls also composer and drush as a colateral, any other php 5.6 application will work never the less
config:
php: '5.6'
database: mysql:5.7
webroot: .
Greetings to my fellow archeologists ;)
I have been wanting to upgrade php5 to php7 on my macbook but i just don't know how. I tried using homebrew and a couple other methods I found online but I just don't know how to complete it.
As a result php5 has been deleted from /usr/local.
How can i get php5 back and then how do i upgrade it to php7?
I want the newest version because I have a minecraft server that I run on my computer that used to use php5 but now requires php7. I have the latest macbook with the latest os.
As you are using homebrew, you can go with homebrew-php. You can install multiple version of PHP with this, and easily switch the version if you want
Or, you can use homebrew with php as usual
brew tap josegonzalez/php
brew tap homebrew/dupes
brew install php55
If you want to upgrade to PHP 7 but still keep current PHP 5, you should unlink PHP 5 first
brew unlink php55
brew install php70
Then you can use PHP 7.
And if you want to switch back to PHP 5, just unlink PHP 7 and link PHP 5
brew unlink php70
brew link php55