5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UbuntuServer12.04でphpenv+php-build使ってみる

Last updated at Posted at 2013-04-29

CHH/phpenv
CHH/php-build

phpenv?

Sets up a separate rbenv environment for PHP

だそうです。
rbenvのように、phpのバージョンをかなり細かく切り替えられます。
# ちうか、内部的にrbenv利用してます。
また、こいつ自身にPHPをビルドする能力はないので、php-buildを利用します。

必要なライブラリ

$ sudo apt-get update
$ sudo apt-get install git git-core curl build-essential libxml2-dev \
libssl-dev libcurl4-gnutls-dev libjpeg-dev libpng12-dev libmcrypt-dev \
libreadline-dev libtidy-dev libxslt1-dev autoconf

必要最小限なのかどうかは分かんないんですけど、まあこれで全部通ります。

phpenv持ってくる

参考:モダンなPHP開発環境を構築する – phpenv + php-build で 複数のPHPバージョンを管理する | Creator Life

$ cd ~
$ mkdir tmp && cd tmp
$ git clone https://github.com/CHH/phpenv.git
$ cd phpenv/bin
$ ./phpenv-install.sh
$ vi ~/.bashrc
...
PATH=$HOME/.phpenv/bin:$PATH
eval "$(phpenv init -)"
$ source ~/.bashrc

php-build持ってくる

参考:php-buildをphpenvのプラグインとして利用 – phpenvとphp-buildで作るモダンなPHP開発環境 | Creator Life

$ git clone https://github.com/CHH/php-build ~/.phpenv/plugins/php-build

php入れる

$ phpenv install 5.4.14
$ phpenv global 5.4.14
$ phpenv rehash
$ php -v
PHP 5.4.14 (cli) (built: Apr 29 2013 17:34:32) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?