Mavericksã«phpenvã§PHP5.5ãå ¥ãã
Mavericksã®ããã©ã«ãã®PHPã¯5.4ã§ãããPHPã®è¤æ°ãã¼ã¸ã§ã³ã®ç°å¢ãä½ããphpenvã使ã£ã¦ãPHP5.5ãå ¥ãã¦ã¿ã¾ããã
æºå
ç°å¢ã¯ãMac OS X 10.9.4 Mavericks ã§ãã
ããã©ã«ãã®PHPã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãï¼
$ which php /usr/bin/php $ php -v PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
äºåã«phpenvãã¤ã³ã¹ãã¼ã«ãã¦ããå¿ è¦ãããã¾ãããã¾ã ã¤ã³ã¹ãã¼ã«ãã¦ããªãå ´åã¯ã以ä¸ã®è¨äºãªã©ãåèã«ãã¦ãã ããã
Mavericksã«phpenvãå ¥ãã - ITæ¢æ¤è¨
phpenvã®æºåãã§ããããã¤ã³ã¹ãã¼ã«ããPHPã®ãã¼ã¸ã§ã³ã決ãã¾ãã
以ä¸ã®ã³ãã³ãã§ã¤ã³ã¹ãã¼ã«å¯è½ãªãã¼ã¸ã§ã³ã表示ã§ãã¾ãï¼
$ phpenv install -l
ããã¦ãPHPã®ã³ã³ãã¤ã«ãªãã·ã§ã³ã決ãã¾ãã
phpenvã®ããã©ã«ããªãã·ã§ã³ã¯ä»¥ä¸ã®ãã¡ã¤ã«ã§ç¢ºèªã§ãã¾ãï¼
~/.phpenv/plugins/php-build/share/php-build/default_configure_options
ã¡ãªã¿ã«ãæ¢åã®PHPã®ã³ã³ãã¤ã«ãªãã·ã§ã³ããã§ãã¯ããã«ã¯ã以ä¸ã®ã³ãã³ããå®è¡ãã¾ãï¼
$ php -i | grep configure | sed -e 's/ /\n/g'
ãªããMacã®sedã§ã¯\nã使ããªããããHomebrewã§gnu-sedãå
¥ããsedã®ä»£ããã«gsedã使ãã¨å®è¡ã§ãã¾ãã
PHPã®ã¤ã³ã¹ãã¼ã«
ã¤ã³ã¹ãã¼ã«ããPHPã®ãã¼ã¸ã§ã³ã¨ã³ã³ãã¤ã«ãªãã·ã§ã³ã決ã¾ã£ãããå®éã®ã¤ã³ã¹ãã¼ã«ãè¡ãã¾ãã
以ä¸ã®ã³ãã³ãã§å®è¡ã§ãã¾ãã
$ CONFIGURE_OPTS="ã³ã³ãã¤ã«ãªãã·ã§ã³" phpenv install 5.5.14
ã³ã³ãã¤ã«ãªãã·ã§ã³ããªãå ´åã¯phpenv以éã®é¨åãæå®ãã¾ãã
ãã®ã³ãã³ããå®è¡ããã¨ãããã¤ãã¯ã¼ãã³ã°ãã¨ã©ã¼ãåºãã¨æãã®ã§ããã®å¯¾å¦æ³ã説æãã¦ããã¾ãã
bisonã®ã¯ã¼ãã³ã°
configure: WARNING: bison versions supported for regeneration of the Zend/PHP parsers: 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7 (found: 2.3).
ããã¯ãPHPã§ãµãã¼ããããbisonããªããã¨ãåå ã§ãã
念ã®ãããã¤ã³ã¹ãã¼ã«ããã¦ããbisonã確èªãã¾ãï¼
$ which bison /usr/bin/bison $ bison --version bison (GNU Bison) 2.3
æ°ãããã¼ã¸ã§ã³ãHomebrewã§æ¢ãã¦ã¿ã¾ãï¼
$ brew search bison bison homebrew/versions/bison27 $ brew info bison bison: stable 3.0.2 (bottled)
3.0.2ã¯æ®å¿µãªããPHPã§ãµãã¼ãããã¦ãã¾ããã
homebrew/versions/bison27ã®æ¹ã調ã¹ã¦ã¿ã¾ãï¼
$ brew versions bison Warning: brew-versions is unsupported and will be removed soon. You should use the homebrew-versions tap instead: https://github.com/Homebrew/homebrew-versions 3.0.2 git checkout 3868896 /usr/local/Library/Formula/bison.rb 3.0.1 git checkout 4715b3c /usr/local/Library/Formula/bison.rb 3.0 git checkout b744b43 /usr/local/Library/Formula/bison.rb 2.7.1 git checkout 804bcf6 /usr/local/Library/Formula/bison.rb 2.7 git checkout adf87c6 /usr/local/Library/Formula/bison.rb
2.7ã¯ãµãã¼ãããã¦ããã®ã§ããããã¤ã³ã¹ãã¼ã«ãããã¨ã«ãã¾ãã
$ cd `brew âprefix`
$ pwd
/usr/local
$ git checkout adf87c6 /usr/local/Library/Formula/bison.rb
$ brew install bison
==> Downloading http://ftpmirror.gnu.org/bison/bison-2.7.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/bison/2.7
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Some formulae require a newer version of bison.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/bison/lib
==> Summary
/usr/local/Cellar/bison/2.7: 36 files, 1.7M, built in 100 second
$ /usr/local/Cellar/bison/2.7/bin/bison --version
bison (GNU Bison) 2.7
ããã§2.7ãã¤ã³ã¹ãã¼ã«ã§ãã¾ããã
ãã®ã¾ã¾ã§ã¯bisonã¨æå®ããæã«ãå¤ãæ¹ãå®è¡ããã¦ãã¾ãã®ã§ã/usr/local/binã«ã·ã³ããªãã¯ãªã³ã¯ãå¼µãã¾ãï¼
$ brew link bison --force Linking /usr/local/Cellar/bison/2.7... 8 symlinks created $ which bison /usr/local/bin/bison
ã¾ã å¤ãæ¹ã表示ãããå ´åã¯ãPATH ã§ /usr/local/bin ã /usr/bin ãããå
ã«ãã¾ãã
$ bison --version bison (GNU Bison) 2.7
re2cã®ã¯ã¼ãã³ã°
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
ããã¯Homebrewã§ã¤ã³ã¹ãã¼ã«ãã¾ãã
$ brew install re2c ==> Downloading https://downloads.sourceforge.net/project/re2c/re2c/0.13.6/re2c- ######################################################################## 100.0% ==> ./configure --prefix=/usr/local/Cellar/re2c/0.13.6 ==> make install /usr/local/Cellar/re2c/0.13.6: 5 files, 304K, built in 25 second
libzã®ã¨ã©ã¼
configure: error: Cannot find libz
ãã㯠Command Line Tools ãã¤ã³ã¹ãã¼ã«ããã¦ããªãããã«çºçããã¨ã©ã¼ã®ããã§ãã
Command Line Tools ãã¤ã³ã¹ãã¼ã«ããã¦ãããã©ããããã§ãã¯ããã«ã¯ã以ä¸ã®ã³ãã³ããå®è¡ãã¾ãï¼
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
ãã㯠Command Line Tools ãè¦ã¤ãããªããã¨ãæå³ãã¾ãã
Command Line Tools ãã¤ã³ã¹ãã¼ã«ããã«ã¯ããã¤ãæ¹æ³ãããããã§ããã以ä¸ã®ã³ãã³ããå®è¡ããã®ãä¸çªç°¡åã§ãï¼
$ xcode-select --install
â»xcode-selectã¯Xcodeã®ã¤ã³ã¹ãã¼ã«å
ã夿´ããããã®ã³ãã³ãã®ããã§ãã
ãã®ã³ãã³ããå®è¡ããã¨ããã¤ã¢ãã°ã表示ãããã®ã§ããã¤ã³ã¹ãã¼ã«ããã¿ã³ãã¯ãªãã¯ãã¦é²ãã¾ãã
å度ã¤ã³ã¹ãã¼ã«ããã§ãã¯ãã¾ãï¼
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables package-id: com.apple.pkg.CLTools_Executables version: 5.1.0.0.1.1396320587 volume: / location: / install-time: 1406345343 groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
ããã§OKã§ãã
åè
- OSX - OS X 10.9 Marvericksã§zlibããªã - Qiita
- xcode - command line tools for new 10.9 OSX for ruby gems? - Stack Overflow
- xcode - How to check if command line tools is installed - Stack Overflow
- Xcode ã® Command Line Tools ãã¤ã³ã¹ãã¼ã« - Qiita
mcrypt.hã®ã¨ã©ã¼
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Homebrewã§libmcryptãã¤ã³ã¹ãã¼ã«ãã¾ãï¼
$ brew install libmcrypt ==> Installing mcrypt dependency: mhash ==> Downloading https://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mh ######################################################################## 100.0% ==> ./configure --prefix=/usr/local/Cellar/mhash/0.9.9.9 ==> make install /usr/local/Cellar/mhash/0.9.9.9: 17 files, 508K, built in 33 second ==> Installing mcryp ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mcrypt-2.6 ######################################################################## 100.0 ==> Pouring mcrypt-2.6.8.mavericks.bottle.tar.g /usr/local/Cellar/mcrypt/2.6.8: 15 files, 448K
åã®ç°å¢ã§ã¯ãããã¾ã§ã®ãã³ããªã³ã°ã§PHPã®ãã«ããæåãã¾ããã
ã¤ã³ã¹ãã¼ã«ããPHPãã¢ã¯ãã£ãã«ãã
ãã®ã¾ã¾ã ã¨ãphpã³ãã³ããå¤ãæ¹ãè¦ã¦ãã¾ãã®ã§ãã¤ã³ã¹ãã¼ã«ããæ¹ãã¢ã¯ãã£ãã«ãã¾ãï¼
$ phpenv global 5.5.14 $ phpenv rehash
ããã§åãæ¿ããã¾ããï¼
$ php -v
PHP 5.5.14 (cli) (built: Jul 26 2014 14:15:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
php.iniã®è¨å®
ä»åã¤ã³ã¹ãã¼ã«ããPHPã®php.iniãã¡ã¤ã«ã¯ä»¥ä¸ã®å ´æã«ããã¾ãï¼
~/.phpenv/versions/5.5.14/etc/php.ini
è¨å®ã確èªããå¿ è¦ã«å¿ãã¦å¤æ´ãã¾ãã
php-fpm
å㯠Nginx+php-fpm ã®æ§æã§ä½¿ã£ã¦ããã®ã§ãphp-fpmã«ã¤ãã¦ã確èªãã¦ããã¾ãã
ä»åã®ã¤ã³ã¹ãã¼ã«ã§å ¥ã£ããã®ã¯ä»¥ä¸ã®å ´æã«ããã¾ãï¼
~/.phpenv/versions/5.5.14/sbin/php-fpm
phpã³ãã³ãã®æ¹ã¯~/.phpenv/shimsã«å
¥ã£ã¦ãã¾ããããªããphp-fpmã³ãã³ãã¯å
¥ã£ã¦ãã¾ããã
ãã®è¾ºã¯ã¾ã ãããã§ãªãã§ããã
ãªã®ã§ãphp-fpmã³ãã³ããå®è¡ããã¨ãå¤ããã®ãå®è¡ããã¾ãã
ããã¯å°ãæ©ã¿ã¾ãããã/usr/local/binã«ã·ã³ããªãã¯ãªã³ã¯ãå¼µã£ã¦ããphpenvã³ãã³ãã¯åãæ¿ãã¦ãããªãã®ã§ãã²ã¨ã¾ãã以ä¸ã®ã¨ã¤ãªã¢ã¹ãå®ç¾©ãã¦ã¡ãã»ã¼ã¸ãåºããã¨ã«ãã¾ããï¼
alias php-fpm="echo 'Error: If you use the default, type /usr/sbin/php-fpm'"
ããã§ãé常ã¯ãã«ãã¹ã§èµ·åããããã«ãããã¹ãªãã§å®è¡ããã¨ã¡ãã»ã¼ã¸ã表示ããããã¨ããå½¢ã«ãªãã¾ãã
ãã¼ã¸ã§ã³ãã¨ã«ã¨ã¤ãªã¢ã¹ãå®ç¾©ãã¦ãè¯ãããããã¾ããã
php-fpmã®è¨å®ãã¡ã¤ã«ã¯ã~/.phpenv/versions/5.5.14/etc/ã«ããã©ã«ãã®ãã¡ã¤ã«ãããã®ã§ããããã³ãã¼ãã¦ä½¿ç¨ãã¾ãã
$ cd ~/.phpenv/versions/5.5.14/etc/ $ cp php-fpm.conf.default php-fpm.conf
é常ã¯ãã®ã¾ã¾ã®å 容ã§è¡ãããã§ãããå¿ è¦ã«å¿ãã¦å¤æ´ãã¦ãã ããã
ãã¨ãèªåèµ·åãã§ããã¨æãã¾ãããåã¯æåèµ·åã«ãã¦ããã®ã§æªèª¿æ»ã§ãã
ä»ã«Webãµã¼ãã¼å´ã®è¨å®ãå¿ è¦ã§ãããPHPã¨ãã¦ã¯ãããã¾ã§ã§ã²ã¨éã使ããã¯ãã§ãã