installphp.info


← Back to home page

Install PHP 7.3 on macOS 12

Warning! This PHP version is end-of-life!

PHP 7.3 reached end of life on 06 Dec 2021 and is no longer being updated. It's strongly recommended to upgrade to the latest version as soon as possible. You can read the official PHP migration guide here.

Installing PHP 7.3 on macOS 12

Prerequisites

  • macOS 12 (Monterey) installed
  • Command Line Tools for Xcode installed
  • Homebrew package manager installed

Installation

  1. Open Terminal
  2. Update Homebrew:
    brew update
  3. Install PHP 7.3:
    brew install [email protected]
  4. Add PHP 7.3 to your PATH:
    echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
    echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
  5. Reload your shell configuration:
    source ~/.zshrc

Verification

  1. Check PHP version:
    php -v
  2. Expected output:
    PHP 7.3.x (cli) (built: ...) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.3.x, Copyright (c) 1998-2018 Zend Technologies
  3. Verify PHP configuration:
    php -i