macportsのphpをアップデート

自宅のmacでは、macportsというパッケージ管理ソフトを使っています。
もちろんphpapacheなどもmac標準のものを使わずに、macportsでダウンロードしたphpapacheを使っています。
前回の記事で、家のmacには、preg_replace_callback関数がなかったと書いていましたが、ちょっと調べてみたら、標準のmacでは、preg_replace_callback関数はありました。でmacports経由でダウンロードしたphpには、その関数がないので、ちょっとバージョンを調べてみたら、
家のmac標準のphpでは、

$/usr/bin/php -v
PHP 5.2.6 (cli) (built: Jul 15 2008 12:18:21) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
||
macportsのphpでは、
>||
$/opt/local/bin/php -v
PHP 5.2.5 (cli) (built: Apr 29 2008 13:49:19) 
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

で、バージョンが古いphpでした。
これは、macportsphpをアップグレートしたら入るんでは!!って思って、アップグレードしました。
まず、いま入っている、phpの確認

$port installed
The following ports are currently installed:
  apache2 @2.2.8_0+darwin_9 (active)
  apr @1.2.12_1+darwin_9
  apr @1.3.3_0 (active)
  apr-util @1.2.12_0
  apr-util @1.3.4_0+mysql5 (active)
  autoconf @2.62_0 (active)
  automake @1.10.1_0 (active)
  bzip2 @1.0.5_0
  bzip2 @1.0.5_1 (active)
  cclient @2007_0 (active)
  ctags @5.7_0 (active)
  curl @7.18.1_1
  curl @7.19.0_0 (active)
  db44 @4.4.20_1 (active)
  db46 @4.6.21_1 (active)
  expat @2.0.1_0 (active)
  fontconfig @2.6.0_0+macosx (active)
  freetype @2.3.5_1
  freetype @2.3.7_1 (active)
  gawk @3.1.6_0 (active)
  gd2 @2.0.35_1 (active)
  gettext @0.17_3 (active)
  gmake @3.81_0 (active)
  gnupg @1.4.8_0
  gnupg @1.4.9_0 (active)
  gperf @3.0.3_0 (active)
  help2man @1.36.4_1 (active)
  ImageMagick @6.4.2-1_0+q16
  ImageMagick @6.4.3-6_0+q16 (active)
  jpeg @6b_2 (active)
  libiconv @1.12_0 (active)
  libmcrypt @2.5.8_0 (active)
  libpng @1.2.26_0
  libpng @1.2.31_0 (active)
  libtool @1.5.26_0 (active)
  libxml2 @2.6.31_0
  libxml2 @2.6.32_1 (active)
  libxslt @1.1.22_0
  libxslt @1.1.23_1 (active)
  lynx @2.8.6rel.5_1+ssl (active)
  m4 @1.4.11_0 (active)
  mhash @0.9.9_0 (active)
  mysql5 @5.0.51a_0+server
  mysql5 @5.0.67_1+server (active)
  ncftp @3.2.1_0 (active)
  ncurses @5.6_0 (active)
  ncursesw @5.6_1 (active)
  nspr @4.7_1 (active)
  openssl @0.9.8g_0
  openssl @0.9.8i_0 (active)
  p5-locale-gettext @1.05_0 (active)
  p5-text-vimcolor @0.11_0 (active)
  pcre @7.6_0
  pcre @7.8_0 (active)
  perl5.8 @5.8.8_2+darwin_9
  perl5.8 @5.8.8_3+darwin_9 (active)
  php5 @5.2.5_3+apache2+imap+macosx+mysql5+pear (active)
  pkgconfig @0.23_0 (active)
  readline @5.2.007_0+darwin_9
  readline @5.2.012_1 (active)
  screen @4.0.3_0 (active)
  spidermonkey @1.7.0_0 (active)
  sqlite3 @3.5.8_0 (active)
  tidy @20051026_0 (active)
  tiff @3.8.2_1+macosx
  tiff @3.8.2_2+darwin_9+macosx (active)
  tree @1.5.1.1_0 (active)
  vim @7.1.298_1
  vim @7.2.021_0 (active)
  wget @1.11.1_0
  wget @1.11.4_0 (active)
  zlib @1.2.3_1 (active)

macportにあるphp5の確認

$port search php5
php5                           www/php5       5.2.6        PHP: Hypertext Preprocessor
php5-devel                     www/php5-devel 5.3.0alpha1  PHP: Hypertext Preprocessor
php5-eaccelerator              www/php5-eaccelerator 0.9.5.3      php5 extension for PHP acceleration, optimization, and dynamic content caching
php5-memcache                  www/php5-memcache 2.1.2        PHP5 bindings for memcache
php5-rrdtool                   www/php5-rrdtool 1.0          PHP 5 glue for rrdtool
php5-syck                      www/php5-syck  0.55         PHP5 bindings for syck
php5-xdebug                    www/php5-xdebug 2.0.3        php5 extension for php debugging
php5-yaz                       www/php5-yaz   1.0.14       PHP/PECL extension for the Z39.50 protocol
php5-gtk                       x11/php5-gtk   2.0.0        PHP-GTK: Gtk+ bindings for PHP 5.

ぬぉ!!やっぱり、今インストールされているものより新しいものがある!!
という事で、新しいphp5をインストール!!

の前に、オプションを確認

$sudo port variants php5
php5 has the variants:
	universal
	darwin_6
	darwin_7
	macosx
	no_web: Don't include any web server support
	apache: Add Apache 1 web server module
	apache2: Add Apache 2.2 web server module (default)
	fastcgi: Add FastCGI web server binary
	gmp: Add GNU MP functions
	dbase: Add dBase file format support
	imap: enable operation with IMAP protocol
	pspell: Add pspell spell-checking functions
	tidy: add Tidy support
	mssql: add support for MS-SQL server
	snmp: use Apple snmp
	macports_snmp: use MacPorts snmp
	mysql3: build MySQL 3 support
	mysql4: build MySQL 4 support
	mysql5: build MySQL 5 support
	oracle: Add Oracle oci8 database functions with the Oracle Instant Client
	postgresql82: provide postgresql82 support
	postgresql83: provide postgresql83 support
	sqlite: build sqlite support
	ipc: build IPC support
	pcntl: provide process control
	pear: add pear stuff
	readline: Add GNU readline functions
	sockets: Add socket communication functions
	t1lib: Add PostScript Type 1 font support with t1lib

以前、このマシンにはpcntl関数がない。。。って思ってましたが、オプションを見るとpcntlって物があり、これを付け加えれば、フォーク関係の関数も使えそうなので、前回のオプション+pcntlもつけて、インストールしよう
まずは、今のパッケージをdeactivate

$sudo port deactivate 
--->  Deactivating php5 

で、新しいphp5パッケージをインストール

$sudo port install  php5 +mysql5+macosxpear+apache2+imap+pcntl

無事入りました!!
これで、ちゃんとpreg_replace_callbackもフォーク関係の関数も使えます。

一件落着!!