installphp.info


← Back to home page

Install PHP 7.0 on macOS 14

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

PHP 7.0 reached end of life on 03 Dec 2018 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.0 on macOS 14

Prerequisites

  • macOS 14 (Sonoma) installed
  • Admin access to your Mac
  • Homebrew package manager installed
  • Terminal application

Installation

  1. Open Terminal application
  2. Update Homebrew:
    brew update
  3. Install PHP 7.0:
    brew install [email protected]
  4. Link PHP 7.0:
    brew link [email protected] --force
  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 7.0.x is installed.

  2. Verify PHP configuration:
    php -i

    This will display the PHP configuration information.

  3. Create a test PHP file:
    echo '<?php phpinfo();' > test.php
  4. Run the test file:
    php test.php

    This should display detailed PHP configuration information.