LoginSignup
6
6

More than 5 years have passed since last update.

macOS High Sierraにphpenv(anyenv)でPHP7のインストール

Last updated at Posted at 2017-10-19

毎度躓くので備忘録として。大体は依存関係で失敗することが多い。
暇が出来れば詳細を…

TL;DR

Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

...

$ brew
Example usage:
  brew search [TEXT|/REGEX/]
  brew (info|home|options) [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install -vd FORMULA

Developers:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
  https://docs.brew.sh/Formula-Cookbook.html

Further help:
  man brew
  brew help [COMMAND]
  brew home

anyenv

$ git clone https://github.com/riywo/anyenv ~/.anyenv
$ echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
$ exec $SHELL -l
$ anyenv
anyenv
Usage: anyenv <command> [<args>]

Some useful anyenv commands are:
   commands            List all available anyenv commands
   local               Show the local application-specific Any version
   global              Show the global Any version
   install             Install a **env
   uninstall           Uninstall a specific **anv
   version             Show the current Any version and its origin
   versions            List all Any versions available to **env

See `anyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/riywo/anyenv#readme

phpenv

$ anyenv install phpenv
$ exec $SHELL -l
$ phpenv
phpenv:
=======
   PHP multi-version installation and management utility.

Usage: phpenv <command> [<args>]

Some useful phpenv commands are:
   commands    List all available phpenv commands
   configure   Edit the current PHP's php.ini configuration file at location
   local       Set or show the local application-specific PHP version
   global      Set or show the global PHP version and update the Apache apxs
   shell       Set or show the shell-specific PHP version
   install     Install a PHP version using the php-build plugin
   uninstall   Uninstall a specific PHP version using the php-build plugin
   rehash      Rehash phpenv shims (run this after installing executables)
   version     Show the current PHP version and its origin
   versions    List all PHP versions available to phpenv
   which       Display the full path to an executable
   whence      List all PHP versions that contain the given executable

See `phpenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/madumlao/phpenv#readme

依存関係のインストール

$ brew install freetype gettext icu4c jpeg libpng libxml2 unixodbc readline openssl re2c libmcrypt autoconf automake

PHPインストール(7.1.9)

$ phpenv install 7.1.9

...

$ phpenv rehash
$ phpenv versions
* system (set by /Users/mac-user/.anyenv/envs/phpenv/version)
  7.1.9
$ phpenv shell 7.1.9
$ php --version
PHP 7.1.9 (cli) (built: Oct 19 2017 10:38:29) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.9, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
6
6
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
6
6