High Sierra(10.13) PHP 5.6, 7.0 멀티 설치하기
Mac OS High Siera를 설치하게 되면, PHP 7.1.7이 설치가 된다.
기존에 PHP 5.6를 사용하려면, 다시 설치를 해야 합니다.
PHP 7이 속도면에서 빠르다고 하지만, 개발해두었던 소스를 다 바꾸기는 버겨움에, 꼭 필요한 부분이 있을때만 수정해 보자.
현재 PHP 7를 설치하려면, brew를 이용해야 한다.
brew를 실행하였더니. 헐 에러가,
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.
음 그럼 git으로 다시 리셋을 하려고 했더니. 또 에러가;;;
$ git reset --hard
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.
다음 과 같은 에러는 xcode developer tools설치하면 고쳐진다고 한다.
$ xcode-select --install
참고: https://apple.stackexchange.com/questions/254380/macos-sierra-invalid-active-developer-path
$cd /usr/local/Library/Homebrew
$sudo git reset --hard
HEAD is now at f0feb40512 libnids: fix option names
$
여러가지 해봤지만,
(결론) 해당 방법이 좋은 것 같습니다.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
참조: 'brew update' errors on MacOS 10.13 (High Sierra)
=================================================================
<<Mac OS High Sierra + PHP 5.6/7.0 개발환경 만들기>>
출처: macOS 10.13 High Sierra Apache Setup: Multiple PHP Versions
Xcode Command Line Tools설치
$xcode-select --install
Homebrew 설치
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
기타
brew --version
brew doctor
Brew
하위 탭 만들기
$brew tap homebrew/php $brew update |
[Apache 설치하기]
기존에 사용하던, Apahce를 Unlink하고, Brew를 통해서 다시 다운로드 합니다.
$sudo apachectl stop $sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null $brew install httpd |
설치 완료
🍺 /usr/local/Cellar/httpd/2.4.28: 1,622 files, 26.0MB
Configure 실행 (자동재시작)
$sudo brew services start httpd
[PHP 설치]
brew install php56 --with-httpd
brew unlink php56
brew install php70 --with-httpd
메뉴얼에서는 PHP Switching Script를 받아서 설치하라고 했는데,
개인적으로 그냥 Script를 만들어서 사용했다.
$sh s.php56.sh (<-->sh s.php70.sh)
[s.pphp56.sh파일]
brew unlink php70
brew link php56
rm /usr/local/etc/httpd/httpd.conf
cp /usr/local/etc/httpd/httpd.conf.php56 /usr/local/etc/httpd/httpd.conf
sudo apachectl -k restart
$php --version
PHP버전 확인하기
[설치 파일]
Mac OS High Sierra(10.13)에서 PHP 56, 70등 멀티 버전 활용을 위한
설치 메뉴얼 포스트:
apachectl를 이용한 버전 확인
$ apachectl -v
Server version: Apache/2.4.29 (Unix)
Server built: Dec 28 2017 00:52:51