Skip to content

Instantly share code, notes, and snippets.

@memememomo
Last active August 29, 2015 14:01
Show Gist options
  • Save memememomo/feb392426b5f141b31c2 to your computer and use it in GitHub Desktop.
Save memememomo/feb392426b5f141b31c2 to your computer and use it in GitHub Desktop.
phpenvの導入して複数バージョンのPHPを管理する ref: http://qiita.com/uchiko/items/5f1843d3d848de619fdf
$ curl -L https://raw.github.com/CHH/phpenv/master/bin/phpenv-install.sh | bash
$ git clone git://github.com/CHH/php-build.git ~/.phpenv/plugins/php-build
$ echo 'export PATH="$HOME/.phpenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(phpenv init -)"' >> ~/.bashrc
$ exec $SHELL -l
$ phpenv install -l
$ wget https://gist.githubusercontent.com/memememomo/91f774b1e41b24f99e1e/raw/fe57f9936dae16c5ab186919c1611c8f6a4b1fbc/php-build.patch
$ patch -u $HOME/.phpenv/plugins/php-build/bin/php-build < php-build.patch
$HOME/.phpenv/versions/{version}/libexec/libphp5.so
$ sudo ln -s $HOME/.phpenv/versions/{version}/libexec/libphp5.so /usr/local/apache2/modules/
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
$ sudo /usr/local/apache2/bin/apachectl restart
5.5.1
5.5.10
5.5.11
5.5.12
5.5.2
$ phpenv install 5.5.12
$ CFLAGS="-g" phpenv install 5.5.12 # コンパイラにオプションを渡す場合
# デフォルトのオプション
$HOME/.phpenv/plugins/php-build/share/php-build/default_configure_options
# 各バージョンごとの設定
$HOME/.phpenv/plugins/php-build/share/php-build/definitions/5.5.12
# オプションを追加する
configure_option "--enable-pcntl"
# オプションを外す
configure_option -D "--with-mysqli"
$ phpenv versions
* system (set by /home/uchiko/.phpenv/version)
5.5.10
5.5.11
5.5.7
5.5.8
$ phpenv global {version} # 全ディレクトリで使うバージョン
$ phpenv local {version} # カレントディレクトリのみで使うバージョン(.php-versionが作成される)
configure_option "--with-apxs2" "/usr/local/apache2/bin/apxs"
$ which apxs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment