phpbrewのインストールテスト
インストールするのにはphpが必要
なぜか必要
環境
- vagrantのcentos64
yumインストール
sudo yum install -y php php-xml sudo yum install -y libxml2 libxml2-devel bzip2-devel libmcrypt libmcrypt-devel libxslt-devel
手順
インストール
wget https://raw.github.com/c9s/phpbrew/master/phpbrew chmod +x phpbrew sudo cp phpbrew /usr/bin/phpbrew
初期化
phpbrew init ---- Phpbrew environment is initialized, required directories are created under /home/vagrant/.phpbrew Paste the following line(s) to the end of your ~/.bashrc and start a new shell, phpbrew should be up and fully functional from there: source /home/vagrant/.phpbrew/bashrc To enable PHP version info in your shell prompt, please set PHPBREW_SET_PROMPT=1 in your `~/.bashrc` before you source `~/.phpbrew/bashrc` export PHPBREW_SET_PROMPT=1 For further instructions, simply run `phpbrew` to see the help message. Enjoy phpbrew at $HOME!! ----
環境設定ファイルを読込
source /home/vagrant/.phpbrew/bashrc
インストールする一覧を取得
phpbrew known ---- Available stable versions: 5.5 versions: 5.5.11, 5.5.10, 5.5.9, 5.5.8, 5.5.7, 5.5.6, 5.5.5, 5.5.4 5.4 versions: 5.4.27, 5.4.26, 5.4.25, 5.4.24, 5.4.23, 5.4.22, 5.4.21, 5.4.20 5.3 versions: 5.3.28, 5.3.27, 5.3.26, 5.3.25, 5.3.24, 5.3.23, 5.3.22, 5.3.21 ----
インストールするモジュール確認
phpbrew variants ---- Variants: all, apxs2, bcmath, bz2, calendar, cgi, cli, ctype, curl, dba, debug, dom, embed, exif, fileinfo, filter, fpm, ftp, gcov, gd, gettext, hash, iconv, icu, imap, intl, ipc, ipv6, json, kerberos, mbregex, mbstring, mcrypt, mhash, mysql, opcache, openssl, pcntl, pcre, pdo, pgsql, phar, posix, readline, session, soap, sockets, sqlite, tidy, tokenizer, wddx, xml, xml_all, xmlrpc, zip, zlib Virtual variants: dbs: sqlite, mysql, pgsql, pdo mb: mbstring, mbregex default: bcmath, bz2, calendar, cli, ctype, dom, fileinfo, filter, ipc, json, mbregex, mbstring, mhash, mcrypt, pcntl, pcre, pdo, phar, posix, readline, sockets, tokenizer, xml, curl, zip, bz2 Using variants to build PHP: phpbrew install php-5.3.10 +default phpbrew install php-5.3.10 +mysql +pdo phpbrew install php-5.3.10 +mysql +pdo +apxs2 phpbrew install php-5.3.10 +mysql +pdo +apxs2=/usr/bin/apxs2 ----
※Variantsのものを追加モジュールとしてインストールできる
5.5.11をインストール
インストール
phpbrew install php-5.5.11 +default +sqlite +mysql +pdo +mb
現在のリストを確認
phpbrew list ---- Installed versions: * (system) php-5.5.11 (/home/vagrant/.phpbrew/php/php-5.5.11) +default+sqlite+mysql+pdo+mb ----
切り替え
phpbrew switch php-5.5.11
バージョンを確認
php -v ---- PHP 5.5.11 (cli) (built: Apr 29 2014 04:33:29) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies ----
phpinfoファイルを作成
cat <<'_EOT_' >> info.php <?php phpinfo(); _EOT_
起動
php -S 192.168.33.10:8080 ---- PHP 5.5.11 Development Server started at Tue Apr 29 04:42:07 2014 Listening on http://192.168.33.10:8080 Document root is /home/vagrant Press Ctrl-C to quit. ----
画面