Multiple PHP version on Mac - Install php and config by brew

Multiple PHP version on Mac - Install php and config

 To install multiple PHP versions on a Mac using Brew, follow the steps below:

Multiple PHP version on Mac - Install php and config
Multiple PHP version on Mac - Install php and config

Install Homebrew by running the following command in the terminal:

bash

Copy code

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install the required dependencies using the following commands:

arduino

Copy code

brew install autoconf automake curl gettext libiconv libmcrypt libtool pkg-config

Install PHP versions by running the following commands:

graphql

Copy code

brew install [email protected]

brew install [email protected]

brew install [email protected]

brew install [email protected]

Once the installation is complete, check the installed PHP versions by running the following command:

perl

Copy code

brew list | grep php

Create symbolic links for each PHP version to make them easily accessible using the following commands:

perl

Copy code

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

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

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

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

Finally, verify the installation and configuration by checking the version of each PHP installation using the following commands:

graphql

Copy code

[email protected] -v

[email protected] -v

[email protected] -v

[email protected] -v

You can also switch between different PHP versions using the brew unlink and brew link commands. For example, to switch to PHP 7.3, run the following commands:

perl

Copy code

brew unlink [email protected]

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

This will set PHP 7.3 as the default version, and you can verify it by running php -v command.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.