This guide explains how to install and run several PHP versions at the same time on macOS, using Apache. Each PHP version is assigned to a specific directory, so you can easily switch PHP versions for any project simply by moving it to the relevant folder. This method allows instant version changes without having to update your server configuration every time.
To install different PHP versions, use Homebrew:
- Add the required tap: