installphp.info


← Back to home page

Install PHP 8.1 on macOS 13

Warning! This version of PHP is outdated.

PHP 8.1 reached end of active support on 25 Nov 2023. As of today, PHP 8.1 is only receiving security related updates through 31 Dec 2025, at which point it will be considered end-of-life and receive no further updates. It's strongly recommended to upgrade to the latest version of PHP before then.

Installing PHP 8.1 on macOS 13

Prerequisites

  • macOS 13 (Ventura) installed
  • Homebrew package manager installed
  • Terminal or iTerm2 application
  • Administrative access to your Mac

Installation

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

Verification

  1. Check PHP version:
    php -v

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

  2. Verify PHP configuration:
    php -i

    This will display detailed PHP configuration information.

  3. Test PHP by creating a simple script:
    echo '<?php phpinfo(); ?>' > test.php
    php test.php

    This should output PHP configuration information in your terminal.