맥 M1에 php 설치하기

1. Homebrew 설치

macOS Requirements

  • A 64-bit Intel CPU or Apple Silicon CPU
  • macOS Catalina (10.15) (or higher)
  • Command Line Tools (CLT) for Xcode (from xcode-select –install or https://developer.apple.com/download/all/) or Xcode
  • The Bourne-again shell for installation (i.e. bash)
$ code-select --install

# Homebrew 설치
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Installation — Homebrew Documentation

2. Php 패키지 설치

$ brew update # 
$ brew search php # 패키지 검색
brew search php
==> Formulae
brew-php-switcher
php
php-code-sniffer
php-cs-fixer
php-cs-fixer@2
php@7.2
php@7.3
php@7.4 ✔
php@8.0
phpbrew
phplint
phpmd
phpmyadmin
phpstan
phpunit
pcp
pup

$ brew install php@7.4 # 원하는 버전의 php를 설치

Homebrew에 대한 명령어는 아래 링크 참고
brew(1) – The Missing Package Manager for macOS (or Linux) — Homebrew Documentation

참고. Homebrew에서 지원하지 않는 버전의 Php 설치

$ brew tap shivammathur/php

$ brew search php
==> Formulae
brew-php-switcher
php
php-code-sniffer
php-cs-fixer
php-cs-fixer@2
php@7.2
php@7.3
php@7.4 ✔
php@8.0
phpbrew
phplint
phpmd
phpmyadmin
phpstan
phpunit
shivammathur/php/php
shivammathur/php/php@5.6
shivammathur/php/php@7.0 ✔
shivammathur/php/php@7.1
shivammathur/php/php@7.2
shivammathur/php/php@7.3
shivammathur/php/php@7.4 ✔
shivammathur/php/php@8.0
shivammathur/php/php@8.2
pcp
pup

$ brew install shivammathur/php/php@7.0

댓글 남기기