Install specific PHP version for mac
Solution 1
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
Solution 2
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:
brew install [email protected]
Installing old version you miss latest bug fix and security fixes so i recommend to you at least PHP 7.2.
Brandon
Updated on July 27, 2022Comments
-
Brandon almost 2 years
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?
-
Brandon almost 5 yearsI did try this, but it installed 7.2.19, which didn't work with magento. How do i tell it to specifically install 7.2.0, as this is the version the docs state is compatible?
-
r00t-err0r almost 5 yearsI don`t see problems with php 7.2.19 because Magento 2.3.1 is certified and tested on PHP 7.2.11 so they support and versions above. Can you please support us with some errors or error logs, maybe you miss some extensions that magento requires.
-
Kevin Labécot over 2 yearsThanks a lot, saved me. But
exolnet/homebrew-deprecated
does not exists anymore. Replaced withshivammathur/php
(I was able to installshivammathur/php/[email protected]
without any issue).