Home >Backend Development >PHP Tutorial >How to Manage Multiple PHP Versions on Mac with Homebrew?
Managing PHP Versions on Mac OSX with Homebrew
Developers often need to switch between different PHP versions while working on projects. This is especially true for testing applications across multiple PHP versions. Homebrew, a package manager for Mac, provides a convenient way to install and manage multiple PHP versions on your system.
To install multiple PHP versions using Homebrew, run the following commands:
# Install PHP 5.3 brew install php@5.3 # Install PHP 8.2 brew install php@8.2
Once installed, you can switch between the PHP versions using the brew link and brew unlink commands. Here's an example of switching between PHP 7.4 and PHP 7.3:
# Unlink PHP 7.4 brew unlink php@7.4 # Link PHP 7.3 brew link php@7.3
Note: Both versions of PHP must be installed for these commands to work. After switching versions, verify that the desired version is active by running the php -v command, which will display the current PHP version.
The above is the detailed content of How to Manage Multiple PHP Versions on Mac with Homebrew?. For more information, please follow other related articles on the PHP Chinese website!