Skip to content

Instantly share code, notes, and snippets.

@Jung0
Last active June 24, 2017 15:50
Show Gist options
  • Save Jung0/023aa62128f7fa7584f6 to your computer and use it in GitHub Desktop.
Save Jung0/023aa62128f7fa7584f6 to your computer and use it in GitHub Desktop.
anyenvでモダンな開発環境構築。PHP,NodeJS,Ruby,Perl,Python ref: http://qiita.com/pfavill/items/f500e46444c86a6f8e6a
--with-apxs2=/usr/sbin/apxs
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew tap homebrew/dupes
$ brew tap homebrew/apache
$ brew search httpd
$ brew install httpd24
# 次のようになっていることを確認
$ which apachectl
/usr/local/bin/apachectl
$ anyenv install plenv
$ anyenv install pyenv
$ anyenv install rbenv
$ anyenv install phpenv
$ anyenv install ndenv
$ anyenv versions
$ mkdir -p $(anyenv root)/plugins
$ git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
$ anyenv update
$ mkdir -p $(anyenv root)/plugins
$ git clone git://github.com/aereal/anyenv-exec.git $(anyenv root)/plugins/anyenv-exe
$ anyenv --version
$ mkdir -p $(anyenv root)/plugins
$ git clone https://github.com/znz/anyenv-git.git $(anyenv root)/plugins/anyenv-git
$ anyenv git gc
$ phpenv install
$ phpenv install 5.6.9
$ phpenv versions
$ phpenv global 5.6.9
$ cd ~/.anyenv/envs/phpenv/plugins/php-build/bin
$ curl https://gist.githubusercontent.com/tkuchiki/10112836/raw/php-build.patch | patch -u php-build -
~/.anyenv/envs/phpenv/versions/5.6.9/libexec/libphp5.so
$ LANG=C ls -l ~/.anyenv/envs/phpenv/lib/libphp5.so | cut -f9- -d' '
/home/ユーザー名/.anyenv/envs/phpenv/lib/libphp5.so -> /home/ユーザー名/.anyenv/envs/phpenv/versions/5.6.9/libexec/libphp5.so*
#LoadModule php5_module ~ディレクトリ
LoadModule php5_module ~ディレクトリ
$ cd ~/.anyenv/envs/phpenv/plugins
$ git clone https://github.com/php-build/php-build.git
$ anyenv update
$ sudo apachectl start
$ apachectl -t
$ git clone https://github.com/riywo/anyenv ~/.anyenv
$vim .bashrc
if [ -d $HOME/.anyenv ] ; then
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
# tmux対応
for D in `\ls $HOME/.anyenv/envs`
do
export PATH="$HOME/.anyenv/envs/$D/shims:$PATH"
done
fi
$ exec $SHELL -l
$ which anyenv
~/.anyenv/bin/anyenv
#
# Use name-based virtual hosting.
#
# NameVirtualHost *:80 (Apache2.4からはこの記述いらないみたい。一応コメントとして残しておきます)
<VirtualHost *:80>
ServerName sample.local
DocumentRoot /Users/ユーザ名/httpd.confで指定したフォルダ名
DirectoryIndex index.php index.html
<Directory "/Users/ユーザ名/httpd.confで指定したフォルダ名">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
#<VirtualHost *:8080>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot "/usr/local/opt/httpd22/docs/dummy-host.example.com"
# ServerName dummy-host.example.com
# ServerAlias www.dummy-host.example.com
# ErrorLog "/usr/local/var/log/apache2/dummy-host.example.com-error_log"
# CustomLog "/usr/local/var/log/apache2/dummy-host.example.com-access_log" common
#</VirtualHost>
#<VirtualHost *:8080>
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot "/usr/local/opt/httpd22/docs/dummy-host2.example.com"
# ServerName dummy-host2.example.com
# ErrorLog "/usr/local/var/log/apache2/dummy-host2.example.com-error_log"
# CustomLog "/usr/local/var/log/apache2/dummy-host2.example.com-access_log" common
#</VirtualHost>
# 使用するポート番号の設定
# localhost/で繋ぎたいので、80ポートにする
Listen 80
# ServerNameの設定
# 上でポート番号を80にしたので、ここも80にする
ServerName localhost:80
# DocumentRootの変更
DocumentRoot "/Users/ユーザ名/フォルダ名"
# .htaccessでURLのoverwriteを許可 (<Directory "/Users/furudate/htdocs">内)
AllowOverride All
# index.phpを使えるように修正 (IfModule dir_module内)
DirectoryIndex index.php index.html
# .phpを実行できるようにMIMEタイプを追加 (IfModule mime_module内)
AddType application/x-httpd-php .php
# バーチャルホストを利用できるようにコメントアウトを解除
Include /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment