LoginSignup
7
0

More than 5 years have passed since last update.

はじめに

php.netのMac OS X へのインストール > バンドルされている PHP の使用法でも紹介されているLiipのPHPは、macOS MojaveではそれまでのmacOSと違って、OSX標準のapacheにインストールできなくなりました。

Installing on Mojave
https://github.com/liip/php-osx/issues/249

これはMojaveでOSXのシステム整合性保護(System Integrity Protection: SIP)がより厳しくなったためですが、これを現状でうまく解決できる方法は現在見つかっていません。

これを回避する方法は現在2つあります。1つはSIPを無効にする方法、1つは標準のapacheの使用を諦めbrewのapacheを使う方法です。

SIPを無効に

1 macOSでコマンド+Rを押しながらリカバリーモードにboot
2 ユーティリティからターミナルアプリを選択
3 csrutil disable; と入力して再起動

brewでapacheインストール

macOSのapacheを停止

sudo apachectl stop`
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null`

brewでapacheをインストール

brew install httpd

インストール確認

which apachectl

apacheスタート

sudo apachectl -k start 

macOS起動時に自動起動

sudo brew services start httpd

PHPをインストール

上記のどちらかを実行した後に https://php-osx.liip.ch を参照してPHPをインストールします。

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2

とすると

[WARNING]
Detected macOS Mojave 10.14. There are serious issues with it, due to the original apache not loading
foreign libraries anymore. PHP within apache will most certainly not work anymore if you proceed!
The cli version still will.
See this issue at https://github.com/liip/php-osx/issues/249 for details and discussion
****
Restart this script with
 curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.2
to really install it

という警告が出るので示されてるようにforceで再度実行します

curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.2

確認

php -v

PHP 7.2.9 (cli) (built: Aug 21 2018 07:42:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.9, Copyright (c) 1999-2018, by Zend Technologies
7
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
0