Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install specific PHP version for mac

I need a specific version of PHP for magento (7.1.3)

With home brew or curl, I can only specify one decimal (7.1, 7.2 etc).

Running

brew install [email protected]

ultimately gets me

php -v
PHP 7.1.29 (cli) (built: May 21 2019 20:05:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.29, Copyright (c) 1999-2018, by Zend 
Technologies

trying to install a specific version (like you can with node using nvm):

brew install [email protected]

gets me

Error: No available formula with the name "[email protected]"

I tried using a curl command, same issue:

https://php-osx.liip.ch/install.sh | bash -s 7.1.3 

gets me

Did or could not download package: 7.1.3-frontenddev

TL;DR: How do i install exact version of PHP (7.1.3) on mac?

like image 569
Brandon Avatar asked May 26 '19 15:05

Brandon


People also ask

How do I install a specific version of PHP on Mac?

In my case, I wanted to install PHP 7.4 since it's the version our server is running. To install a specific version, we can use the @ notation. This will run the installer, and it should end with a success notice in your terminal.

Where is PHP installed on Mac?

Set the php. ini location or use the default A typical default location on macOS is /usr/local/php/php.


1 Answers

For the deprecated php version in the brew. Please run this.

brew tap exolnet/homebrew-deprecated

Then choose your version.

brew install [email protected]

Switch back to the first PHP version.

brew link --force --overwrite [email protected]

Here is the reference,

macOS 10.15 Catalina Apache Setup: Multiple PHP Versions

like image 148
YuAn Shaolin Maculelê Lai Avatar answered Oct 06 '22 21:10

YuAn Shaolin Maculelê Lai