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?
4
Answers
I didn`t find this tagged version on PHP git page, so probably is repacked version for some linux distribution.
If you think that you need ~7.1.3 version because that wrotes on system requirements for magento, you can also use 7.2.0 as they wrote in
https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html
so you can use:
Installing old version you miss latest bug fix and security fixes so i recommend to you at least PHP 7.2.
For the deprecated php version in the brew. Please run this.
Then choose your version.
Switch back to the first PHP version.
Here is the reference,
macOS 10.15 Catalina Apache Setup: Multiple PHP Versions
brew tap exolnet/homebrew-deprecated
Is deprecated.
I recommend shivammathur/php instead. Here’s an example of how to use it:
brew tap shivammathur/php
brew install shivammathur/php/[email protected]
brew link --overwrite --force shivammathur/php/[email protected]
Then restart the terminal and test your PHP version:
php -v
You can try phpbrew – I needed to install a specific sub-version (brew will only allow me to install
[email protected]
which will mean8.0.26
while I specifically need8.0.25
).