installphp.info


← Back to home page

Install PHP 7.1 on macOS 14

This version of PHP is actively supported.

Good news! PHP 7.1 is being actively supported through 21 Nov 2024. After that point, it's advisable to upgrade to the latest version, since the PHP team will only offer security-related support until 21 Nov 2024, at which point PHP 7.1 will be considered "end-of-life".

Installing PHP 7.1 on macOS 14

Prerequisites

  • macOS 14 (Sonoma) installed
  • Command Line Tools for Xcode
  • Homebrew package manager

Installation

  1. Open Terminal

  2. Install Homebrew if not already installed:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Add the PHP tap to Homebrew:

    brew tap shivammathur/php
  4. Install PHP 7.1:

    brew install shivammathur/php/[email protected]
  5. Link PHP 7.1:

    brew link [email protected] --force

Verification

  1. Check PHP version:

    php -v

    You should see output indicating PHP 7.1.x is installed.

  2. Verify PHP configuration:

    php -i

    This will display detailed PHP configuration information.

  3. Test PHP by creating a simple PHP file:

    echo '<?php phpinfo(); ?>' > phpinfo.php
    php phpinfo.php

    This should display PHP configuration information in your terminal.