ãphpã è¤æ°ã®PHPãã¼ã¸ã§ã³ã管çããphpbrew
ä»äºã§PHPã使ãäºããã£ã¦ãCentOS6ã®ç°å¢ã«PHPãã¤ã³ã¹ãã¼ã«ããã
$ php -v PHP 5.3.3 (cli) (built: May 7 2012 20:13:47) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
...å¤ãã§ããã
ã¨ãããã¨ã§ãã¼ã¸ã§ã³ãä¸ããä½æ¥ã«ããããã¨æã£ãã®ã§ãããå®ã¯ãã®ç°å¢ å¹¾ã¤ãã·ã¹ãã ãå ¥ããoræ¢ã«å ¥ã£ã¦ãã¦PHPã®ãã¼ã¸ã§ã³ãä¸ãã¦ã®åä½ç¢ºèªãããã¦ããªããã®ãããã
éçºç°å¢ã¨ã¯ããããããã«åããªããªã£ã¦ã¯ä¸æ«ã ã ããã ãã®çºã«ããã¤ãVirtualBoxãè¤è£½ããã®ããã³ã»ã³ã¹ã ã¨æã£ãã®ã§ PHPã®ãã¼ã¸ã§ã³ç®¡çãã¼ã«ãå°å ¥ãã¦ã¿ããã¨ã«ããã
æåæã ã¨phpenvã¨ãã«ãªããã ãã©ãä»åã¯phpbrewã楽ã§ããã¨ããã®ãä½å¦ãã§è¦ããã¨ããã 使ã£ããã¨ããªãã®ã§ãã¡ãã試ãã¦ã¿ããã¨ã«ã
ã¤ã³ã¹ãã¼ã«ã«ã¯GitHubã®Readmeãè¦ãã®ãä¸çªã¯ããã®ã§ããããã¾ãã¤ã³ã¹ãã¼ã«ã§ããªãé¨åããã£ãã®ã§ä»¥ä¸æé ã§ãã
Readmeã«æ¸ãã¦ããéãã«ã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ã£ãã
$ curl -O https://raw.github.com/c9s/phpbrew/master/phpbrew % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
ã¨ãããã¨ã§ãcurlã¯ä¸æ¦ããã¦wgetã«ãããã証ææ¸ã®ã¨ã©ã¼ã§è½ã¡ã¦ãã¾ãã
$ wget https://raw.github.com/c9s/phpbrew/master/phpbrew --yyyy-mm-dd hh:mm:ss-- https://raw.github.com/c9s/phpbrew/master/phpbrew Resolving raw.github.com... 103.245.222.133 Connecting to raw.github.com|103.245.222.133|:443... connected. ERROR: certificate common name `www.github.com' doesn't match requested host name `raw.github.com'. To connect to raw.github.com insecurely, use `--no-check-certificateâ.
æ¥æ¬èªã ã¨ãããªæãã
$ wget https://raw.github.com/c9s/phpbrew/master/phpbrew --yyyy-mm-dd hh:mm:ss-- https://raw.github.com/c9s/phpbrew/master/phpbrew raw.github.com ãDNSã«åããããã¦ãã¾ã... 103.245.222.133 raw.github.com|103.245.222.133|:443 ã«æ¥ç¶ãã¦ãã¾ã... æ¥ç¶ãã¾ããã ã¨ã©ã¼: 証ææ¸ã«è¨è¼ããã¦ããåå `www.github.com' ã¨ãã¹ãå `raw.github.com' ãä¸è´ãã¾ãã raw.github.com ã«å®å ¨ã®ç¢ºèªãããªãã§æ¥ç¶ããã«ã¯ã`--no-check-certificate' ã使ã£ã¦ãã ããã
ã¨ãããã¨ã§ã¨ã©ã¼ã«ãããããã«ã--no-check-certificateãããªãã·ã§ã³ã«æå®ããã
wget --no-check-certificate https://raw.github.com/c9s/phpbrew/master/phpbrew
ããã§ç¡äºDLã§ãã¾ããã
åã£ç«¯ããã³ã±ãã¨ã¯æããããã
ã--no-check-certificateããä»ãã¦ãã¨ã©ã¼ãåºãå ´åã¯httpsãhttpã«ãã¡ããã¾ãããã
wget http://raw.github.com/c9s/phpbrew/master/phpbrew
ããã§ãã¾ã ãã¡ãªå ´åãæ¬å®¶ã«DLããã®ã§FTPãªãSambaãªãã§ãµã¼ãã«æã£ã¦ããã¾ãããã
ç¶ã...
phpbrewã«å®è¡æ¨©ãä¸ãã¦/usr/biné ä¸ã«è¨ç½®ãã¾ãã
$ chmod +x phpbrew $ cp phpbrew /usr/bin/phpbrew
åæè¨å®ã³ãã³ã
$ phpbrew init
èµ·åæã«è¨å®ãã¡ã¤ã«ãèªã¿è¾¼ãããã«.bashrcã«ã³ãã³ãã追è¨ãã¾ãã
source ~/.phpbrew/bashrc
ããã§ããç¨åº¦ã®è¨å®ã¯å®äº
ã¤ã³ã¹ãã¼ã«ã§ããPHPã®ãã¼ã¸ã§ã³ã確èªããå ´å
$ phpbrew known
ããã§ãããªã¨ã©ã¼ãåºãäºãããã¾ãã
PHP Fatal error: Class 'DOMDocument' not found in phar:///usr/bin/phpbrew/PhpBrew/PhpSource.php on line 2 Fatal error: Class 'DOMDocument' not found in phar:///usr/bin/phpbrew/PhpBrew/PhpSource.php on line 2
ããã¯php-xmlãã¤ã³ã¹ãã¼ã«ããã¦ããªãçºãªã®ã§ãyumãªãã§ã¤ã³ã¹ãã¼ã«ãã¦ãã ããã
ã¨ã©ã¼ãåºãªãå ´åã¯ä»¥ä¸ã®ããã«PHPã®ãã¼ã¸ã§ã³ã表示ããã¾ãã
$ phpbrew known Available stable versions: 5.5 versions: 5.5.12, 5.5.11, 5.5.10, 5.5.9, 5.5.8, 5.5.7, 5.5.6, 5.5.5 5.4 versions: 5.4.28, 5.4.27, 5.4.26, 5.4.25, 5.4.24, 5.4.23, 5.4.22, 5.4.21 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ã使ããããã«ãªã£ãã
phpbrew known ã§è¡¨ç¤ºããã¦ããPHPã®ãã¼ã¸ã§ã³ãã¤ã³ã¹ãã¼ã«ããã¨ãã¯
$ phpbrew install 5.4.28
ããã«configãªãã·ã§ã³ãæå®ããå ´å㯠+defaultãå ãã¦ãããã¨è¯ãã
$ phpbrew install 5.4.28 +detault
configãªãã·ã§ã³(variants)ã®è©³ç´°ãè¦ããå ´å
$ 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
ã+defaultãã¨ããæã¯
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
ä¸è¨ãæå®ãããã
次ã«ã¤ã³ã¹ãã¼ã«å¾PHPã®åãæ¿ãã®ä»æ¹
ä¸æçã«PHPã®ãã¼ã¸ã§ã³ãå¤ãããå ´å
$ phpbrew use 5.4.28
ãuseãã§æå®ããå ´åãåèµ·åããæã«ã¯è¨å®ããã¦ããPHPã®ãã¼ã¸ã§ã³ã¸æ»ãã®ã§ãä¸æçã«åãæ¿ãããæã«ä½¿ãã åèµ·åãã¦ããã¼ã¸ã§ã³ãå¤ããããªãå ´åã¯ãswitchãã使ãã
$ phpbrew switch 5.4.28
ããã§PHPã®ãã¼ã¸ã§ã³ã®åãæ¿ããã§ããã