(2013-03-25追è¨)ä¸è¨PHPã®ãã«ãã«ã¯gccãautoconfãautomakeãlibtoolãbisonãre2cãlibmcryptãjpegãlibpngãflexï¼PHP 5.2.17ã®ã¿ï¼ãªã©ã®ã¤ã³ã¹ãã¼ã«ãå¿ è¦ã§ãã
PHPã®ãã¼ã¸ã§ã³ãè²ã æãããã¨ãããã¼ãºã¯å¤ãã®äººããæã¡ã ã¨æãã¾ããããã解決ããæ¹æ³ã®ä¸ã¤ã«php-buildãããã¾ãããã®ãã¼ã«ã¨phpenvãçµã¿åããã¦ä½¿ããã¨ã§ãæ§ã ãªãã¼ã¸ã§ã³ã®PHPã楽ã«æ±ããã¨ãã§ãã¾ãã
ããã2ã¤ã®ãã¼ã«ã«ã¤ãã¦ã¯æ¢ã«ä»ã®æ¹ãç´¹ä»ããã¦ãã¾ããã両ãã¼ã«ã®ææ°ãã¼ã¸ã§ã³ã«è¿½éãããå ´åãªã©ãå°ã ãããã«ããç¹ãããæ°ããã¾ããã¾ããã¤ã³ã¹ãã¼ã«æ¹æ³ãä½ç¨®é¡ãæµåããããã©ãããã®ããã¹ããæ©ãã§ãã人ãããã®ã§ã¯ãªãã§ããããã
æ¬ç¨¿ã§ã¯phpenv+php-buildãåãã©ã使ã£ã¦ããããç´¹ä»ãã¾ããæ§ç¯ã»éç¨ã®ä¸ä¾ã¨ãã¦åèã«ãªãã°å¹¸ãã§ãã
phpenvã¨php-build
php-buildã¯è¤æ°ã®PHPç°å¢ãæ§ç¯ããããã®ãã¼ã«ã§ããphpenvã¨ä½µç¨ãããã¨ã§ãphpã¨ã¿ã¤ãããã¨ãã«å¼ã³åºãããPHPã®ãã¼ã¸ã§ã³ãèªç±ã«åãæ¿ãããã¨ãã§ãã¾ããåæ§ã®ãã¼ã«ã¨ãã¦ã¯Rubyã®rvmãæåã§ããã
åèªèº«ãè¿ãç®çã§phpallã¨ãããã¼ã«ãä½ã£ã¦ããã®ã§ãããphpenv+php-buildã¯æ¬¡ã®ãããªåªä½æ§ãæã£ã¦ãã¾ãã
- phpizeã³ãã³ããªã©ãå«ãPHPã®ãã¼ã¸ã§ã³ãåãæ¿ãããã
- Extensionã®éçºæã«é常ã«ä¾¿å©ï¼
- PEARãExtensionã®ãã£ã¬ã¯ããªã«ã¤ãã¦PHPã®ãã¼ã¸ã§ã³ãã¨ã«å¥ã§æã£ã¦ãã
- APCãXdebugãªã©ãå®æ¦ã«å³ããExtensionããã«ããã¦ããã
3ã¤ãã®é ç®ã¯ã¡ãªããããã¡ãªããããã話é¡ã®ããã«æãã¾ããã¨ããã®ããphpallã§ã¯ãã«ãããExtensionãããªãçµã£ã¦ãããããæ¯è¼çå¤ãã®ç°å¢ã§PHP5.0ç³»ããå ¨ãã¼ã¸ã§ã³ããã«ãã§ããå¾åãããã¾ããä¸æ¹ã§ãphp-buildã¯ãã使ãããExtensionã®å¤§å¤æ°ããã«ããããã¨ããã®ã§ããããã®åã ãé¢é£ã©ã¤ãã©ãªãè¦æ±ãã¾ããå¾è¿°ããããã«åé¿çãããã®ã§ãããç°å¢ã«ãã£ã¦ã¯å°ãæ·å± ãé«ããªãããããã¾ããã
ã¤ã³ã¹ãã¼ã«
ã¾ãphpenvãã¤ã³ã¹ãã¼ã«ãã¾ããããã¤ã³ã¹ãã¼ã«ã«ã¯gitã³ãã³ããå¿ é ã§ãã
curl -L https://raw.github.com/CHH/phpenv/master/bin/phpenv-install.sh | bash
ä¸è¨ã³ãã³ãã®çµäºæã®ã¡ãã»ã¼ã¸ã«å¾ãã.bashrcã¾ãã¯.zshrcã®æ«å°¾ã«æ¬¡ã®2è¡ã追å ãã¦ã·ã§ã«ãåèµ·åãã¾ãã
PATH=$HOME/.phpenv/bin:$PATH # Add phpenv to PATH for scripting eval "$(phpenv init -)"
次ã«ãphp-buildãphpenvã®ãã©ã°ã¤ã³ã¨ãã¦ã¤ã³ã¹ãã¼ã«ãã¾ããä¸è¨ã®ããã«ãããã¨ã§ããphpenv installãã³ãã³ããæå¹ã«ãªãã¾ããããã¯ruby-buildãrbenvã®ãã©ã°ã¤ã³ã¨ãã¦ä½¿ãããæ¹ãçä¼¼ããã®ã§ãã
mkdir $HOME/.phpenv/plugins cd $HOME/.phpenv/plugins git clone https://github.com/php-build/php-build.git
以ä¸ã®2è¡ã¯åã®åºãã¦ããPull Requestãadd rbenv-install for working as plugin to CHH's phpenvããéã£ããä¸è¦ã«ãªããã§ããããã¾ã®ã¨ããæ¾ç½®ããã¦ãã¾ãã
ï¼2013-06-19追è¨ï¼ä»¥ä¸ã®2è¡ã¯php-buildææ°çï¼0.10.0ï¼ä»¥éã¯ä¸è¦ã«ãªãã¾ããã
curl https://raw.github.com/hnw/php-build/plugin-to-chh-phpenv/bin/rbenv-install > php-build/bin/rbenv-install chmod a+x php-build/bin/rbenv-install
PHPã®ãã«ã
ã§ã¯æ©éPHPã®åãã¼ã¸ã§ã³ããã«ããã¦ã¿ã¾ãããããphpenv install --completeãã¨ã¿ã¤ãããã¨ã¤ã³ã¹ãã¼ã«å¯è½ãªå ¨ãã¼ã¸ã§ã³ã表示ããã¾ããzshãå©ç¨ãã¦ããå ´åã¯ããphpenv install ãã®å¾ã§tabãã¼ãæ¼ãã¨åè£ãåºã¦ãã¾ãã
5.2.17 ï¼ç¥ï¼ 5.3.16 ï¼ç¥ï¼ 5.3snapshot ï¼ç¥ï¼ 5.4.6 5.4snapshot
ããªãè¨å¤§ãªéãåºã¦ãã¾ããã大åã¯ä¸è¦ãªãã®ã ã¨æãã¾ããã¨ã¯ãããsnapshotããã«ãã§ããã®ã¯ç´ æ´ãããã§ãããä»åã¯5.2.17, 5.3.16, 5.4.6ã®3ãã¼ã¸ã§ã³ããã«ããã¦ã¿ã¾ãããã
phpenv install 5.2.17 phpenv install 5.3.16 phpenv install 5.4.6
ãã«ããªãã·ã§ã³ãå¤æ´ãã
ãã«ãã®éãã³ã³ãã¤ã©ã«æ¸¡ããªãã·ã§ã³ãå¤æ´ãããã¨ãã§ãã¾ãããã¨ãã°-gã¤ãã§ã³ã³ãã¤ã«ãããå ´åã¯æ¬¡ã®ããã«ãªãã¾ãã
CFLAGS="-g" phpenv install 5.2.17 CFLAGS="-g" phpenv install 5.3.16 CFLAGS="-g" phpenv install 5.4.6
ãããã¦ããã¨gdbã§PHPã®å¦çã追ãããããå ´åã«ä¾¿å©ã§ã*1
ã¾ããconfigureã®ãªãã·ã§ã³ãå¤æ´ãããã¨ãã§ãã¾ããconfigureãªãã·ã§ã³ã¯PHP 5.2.17ãä¾ã«æããã°ä¸è¨ã®ãã¹ã«è¨è¿°ãã¦ããã¾ãã
$HOME/.phpenv/plugins/php-build/share/php-build/definitions/5.2.17
åã®ç°å¢ã§ã¯PHP 5.2.17ã§mysqliãæå¹ã«ããã¨ãªãããªã³ã¯ãéããªãã£ãã®ã§ãmysqliã«é¢ããè¡ã次ã®ããã«ä¿®æ£ãã¦ä½¿ã£ã¦ãã¾ãã
configure_option -D "--with-mysqli"
ãã®-Dã¨ããã®ã¯ããã©ã«ãã§æå®ããã¦ããconfigureãªãã·ã§ã³ãé¤å»ããã¨ããæå³ã§ããã¾ãã-Rã§ããã°æå®ããã¦ããconfigureãªãã·ã§ã³ã®å¤ãå¤æ´ããæå®ã«ãªãã¾ãã
ã¡ãªã¿ã«ããã©ã«ãã®configureãªãã·ã§ã³ã¯ä¸è¨ã®ãã¹ã«è¨è¿°ãã¦ããã¾ãã
$HOME/.phpenv/plugins/php-build/share/php-build/default_configure_options
ããã¨ãã¼ã¸ã§ã³æ¯ã®æå®ããã¼ã¸ãããã®ãåãã¼ã¸ã§ã³ã®configureãªãã·ã§ã³ã«ãªãããã§ãã
phpenvã®ãã¼ã¸ã§ã³ã¢ããã«è¿½éãã
phpenvã®ããã¥ã¡ã³ãã«å¾ãã°ããã¼ã¸ã§ã³ã¢ããã¯æ¬¡ã®ããã«è¡ãã¾ãã
curl https://raw.github.com/CHH/phpenv/master/bin/phpenv-install.sh | UPDATE=yes bash
ãã ããããã¯ä»ã®ã¨ãã$HOME/.phpenv以ä¸ã§git pull origin masterããã ãã§ããããã ã¨å é¨çã«å©ç¨ãã¦ããrbenvã®ãã¼ã¸ã§ã³ã¢ããã«ãã追éã§ããªãã®ã§ãphpenvèªä½ã®ãã°ãè¦ã¤ãã£ããããªå ´åã¯æ¹ãã¦æ°è¦ã¤ã³ã¹ãã¼ã«ãã¦ãã¾ãã®ãæã§ãã
php-buildã®ãã¼ã¸ã§ã³ã¢ããã«è¿½éãã
åã®ããæ¹ã ã¨ãphp-buildã®ãã¼ã¸ã§ã³ã¢ããã«ãgitã³ãã³ããå©ç¨ãã¾ããææ°çã«è¿½éããå ´åã¯æ¬¡ã®ããã«ãªãã¾ãã
cd $HOME/.phpenv/plugins/php-build/ git pull
ã¾ããç¹å®ã®ãã¼ã¸ã§ã³ã«ãã¦ããããå ´åã¯æ¬¡ã®ããã«ãã§ãã¾ãã
cd $HOME/.phpenv/plugins/php-build/ git fetch git checkout v0.8.0
使ãæ¹
ä¸è¨ã®ããã«ãã¦ãã¼ã¸ã§ã³ãåãæ¿ãã¦ä½¿ãã¾ãã
phpenv global 5.2.17 # php-buildã§ä½ã£ã5.2.17ç°å¢ã«ãªã phpenv global system # é常ã®PATHå ã§è¦ã¤ããPHPç°å¢ã«ãªã
ä¸è¨ã³ãã³ãã§ãã¼ã¸ã§ã³ãåãæ¿ããã¨ãphpã³ãã³ãã ãã§ãªãphpizeãpyrusãªã©ãåãã¼ã¸ã§ã³ã®ãã®ã«åãæ¿ããã¾ãã
åèURL
大åã®å 容ã¯@yuya_takeyamaããã®è¨äºãèªãã°ãããã¾ãã
- php-build
- phpenv
- php-build で PHP 5.4.0 beta1 をビルドする - Born Too Late
- phpenv で複数の PHP 環境を管理する - Born Too Late
- 第57回PHP勉強会@東京で開発環境構築について話して来た - Born Too Late
- phpenv + php-build を使って 5.3 と 5.4 を共存させつつ php-fpm を使う - 肉とご飯と甘いもの @ sotarok
- rbenv phpenvã§å é¨çã«å©ç¨ãã¦ããrbenvã®ãã¼ã¸ãREADMEãåèã«ãªãã
*1:å®éã«gdbã§å©ç¨ããå ´åã¯ãphp-buildã®ä¸ã§make cleanãããã®ãã³ã¡ã³ãã¢ã¦ãããå¿ è¦ãããã¾ãã