$ sudo port install php5 +postgresql +apache2 +pear
---> Fetching curl
---> Attempting to fetch curl-7.18.2.tar.bz2 from http://curl.haxx.se/download/
---> Verifying checksum(s) for curl
---> Extracting curl
---> Configuring curl
---> Building curl with target all
---> Staging curl into destroot
---> Installing curl 7.18.2_0
---> Activating curl 7.18.2_0
---> Cleaning curl
---> Fetching gd2
---> Attempting to fetch gd-2.0.35.tar.bz2 from http://www.libgd.org/releases/
---> Verifying checksum(s) for gd2
---> Extracting gd2
---> Applying patches to gd2
---> Configuring gd2
---> Building gd2 with target all
---> Staging gd2 into destroot
---> Installing gd2 2.0.35_1
---> Activating gd2 2.0.35_1
---> Cleaning gd2
---> Fetching libmcrypt
---> Attempting to fetch libmcrypt-2.5.8.tar.bz2 from http://downloads.sourceforge.net/mcrypt
---> Verifying checksum(s) for libmcrypt
---> Extracting libmcrypt
---> Configuring libmcrypt
---> Building libmcrypt with target all
---> Staging libmcrypt into destroot
---> Installing libmcrypt 2.5.8_0
---> Activating libmcrypt 2.5.8_0
---> Cleaning libmcrypt
---> Fetching mhash
---> Attempting to fetch mhash-0.9.9.tar.bz2 from http://downloads.sourceforge.net/mhash
---> Verifying checksum(s) for mhash
---> Extracting mhash
---> Configuring mhash
---> Building mhash with target all
---> Staging mhash into destroot
---> Installing mhash 0.9.9_0
---> Activating mhash 0.9.9_0
---> Cleaning mhash
---> Fetching php5
---> Attempting to fetch php-5.2.6.tar.bz2 from http://www.php.net/distributions/
---> Verifying checksum(s) for php5
---> Extracting php5
---> Configuring php5
---> Building php5 with target all
---> Staging php5 into destroot
Warning: php5 requests to install files outside the common directory structure!
---> Installing php5 5.2.6_1+apache2+macosx+pear
If this is your first install, you might want
cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
* copy /opt/local/etc/php.ini-dist to /opt/local/etc/php.ini
---> Activating php5 5.2.6_1+apache2+macosx+pear
---> Cleaning php5
variantsの+postgresqlが間違ってた。
variantsを確認。
$ port variants php5
php5 has the variants:
universal
darwin_6
darwin_7
macosx
apache: for Apple Apache
apache2: for current Apache
fastcgi: add fastcgi 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
正しくは、+postgresql83。
改めてインストール。ついでにmysql5とsqliteを追加。(MySQL5を先にインストールしておく。)
$ sudo port install php5 +postgresql83 +mysql5 +sqlite +apache2 +pear
---> Fetching mysql5
---> Attempting to fetch mysql-5.0.67.tar.gz from http://distfiles.macports.org/mysql5
---> Verifying checksum(s) for mysql5
---> Extracting mysql5
---> Configuring mysql5
---> Building mysql5 with target all
---> Staging mysql5 into destroot
---> Installing mysql5 5.0.67_0
---> Activating mysql5 5.0.67_0
---> Cleaning mysql5
---> Fetching php5
---> Verifying checksum(s) for php5
---> Extracting php5
---> Configuring php5
---> Building php5 with target all
---> Staging php5 into destroot
Warning: php5 requests to install files outside the common directory structure!
---> Installing php5 5.2.6_1+apache2+macosx+mysql5+pear+postgresql83+sqlite
If this is your first install, you might want
cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
* copy /opt/local/etc/php.ini-dist to /opt/local/etc/php.ini
---> Activating php5 5.2.6_1+apache2+macosx+mysql5+pear+postgresql83+sqlite
Error: Target org.macports.activate returned: Image error: Another version of this port (php5 @5.2.6_1+apache2+macosx+pear) is already active.
Error: Status 1 encountered during processing.
最初のインストールが残っていたので、activateできなかったみたい。
いったんアンインストールしてインストールしなおす。
$ sudo port uninstall php5
---> The following versions of php5 are currently installed:
---> php5 @5.2.6_1+apache2+macosx+mysql5+pear+postgresql83+sqlite
---> php5 @5.2.6_1+apache2+macosx+pear (active)
Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.
php5が複数あるからフルで指定しないとアンインストールできないらしい。
$ sudo port uninstall php5 @5.2.6_1+apache2+macosx+pear
---> Deactivating php5 5.2.6_1+apache2+macosx+pear
---> Uninstalling php5 5.2.6_1+apache2+macosx+pear
アンインストールできたので、インストールしなおす。
$ sudo port install php5 +postgresql83 +mysql5 +sqlite +apache2 +pear
---> Activating php5 5.2.6_1+apache2+macosx+mysql5+pear+postgresql83+sqlite
---> Cleaning php5
インストールは終わっていたようで、activateだけされた。
インストール時のメッセージにある通り、apxsでapacheにphp5モジュールを追加する。
$ cd /opt/local/apache2/modules/
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
Password:
[activating module `php5' in /opt/local/apache2/conf/httpd.conf]
添付されているサンプルからphp.iniをコピー。
$ sudo cp /opt/local/etc/php.ini-dist /opt/local/etc/php.ini
/opt/local/apache2/conf/httpd.confに以下を追加。
Include conf/extras-conf/mod_php.conf