- OS標準のApacheを停止
システム環境設定 → 共有 → Web共有 のチェックを外す - 標準のバージョンを控えてみる
[shell]
Server version: Apache/2.2.14 (Unix)Server built: Feb 10 2010 22:22:39
PHP 5.3.1 (cli) (built: Feb 11 2010 02:32:22)
※httpd -v
[/shell] - MacPorts のバージョンは?
[text]
port search php5
port search apache2
[/text]
php5 @5.3.2 (lang, php, www)
apache2 @2.2.15 (www) - MySQL5 serverを入れる
[text]
hikosama-no-iMac:~ hikosama$ sudo port install php5 +apache2 +mysql5 +pear
Password:
—> Computing dependencies for php5
—> Dependencies to be installed: apache2 apr apr-util db46 expat libiconv gperf sqlite3 pcre bzip2 autoconf213 gawk gettext m4 perl5 perl5.8 gsed libtool automake autoconf help2man p5-locale-gettext libxml2 mhash pkgconfig
—> Fetching apr
—> Attempting to fetch apr-1.4.2.tar.bz2 from ftp://ftp.infoscience.co.jp/pub/net/apache/dist/apr
… 略
###########################################################
# A startup item has been generated that will aid in
# starting apache2 with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load apache2
###########################################################
Note: apache2 installs files outside the common directory structure.
… 略
—> Fetching php5
—> Attempting to fetch php-5.3.2.tar.bz2 from http://www.php.net/distributions/
—> Verifying checksum(s) for php5
—> Extracting php5
—> Applying patches to php5
—> Configuring php5
The +mysql5 variant is obsolete. Please install the php5-mysql port instead.
—> Building php5
—> Staging php5 into destroot
Note: php5 installs files outside the common directory structure.
—> Installing php5 @5.3.2_0+apache2+mysql5+pear
—> Activating php5 @5.3.2_0+apache2+mysql5+pear
To customize php, copy
/opt/local/etc/php5/php.ini-development (if this is a development server) or
/opt/local/etc/php5/php.ini-production (if this is a production server) to
/opt/local/etc/php5/php.ini and then make changes.If this is your first install, you need to activate PHP in your web server.
To enable PHP in Apache, run
cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
—> Cleaning php5
[/text] - Apache2 が 自動起動するように設定
[text]
hikosama-no-iMac:~ hikosama$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
[/text] - php.ini コピー
[text]
hikosama-no-iMac:~ hikosama$ sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini
[/text] - php5-mysql をインストール
The +mysql5 variant is obsolete. Please install the php5-mysql port instead.
って書いてあるから、指示通りインスートール。
[text]
hikosama-no-iMac:~ hikosama$ sudo port install php5-mysql
—> Computing dependencies for php5-mysql
—> Fetching php5-mysql
—> Verifying checksum(s) for php5-mysql
—> Extracting php5-mysql
—> Configuring php5-mysql
—> Building php5-mysql
—> Staging php5-mysql into destroot
—> Installing php5-mysql @5.3.2_0+mysqlnd
To use mysqlnd with a local MySQL server, edit /opt/local/etc/php5/php.ini and set
mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket
to /opt/local/var/run/mysql5/mysqld.sock
—> Activating php5-mysql @5.3.2_0+mysqlnd
—> Cleaning php5-mysql
[/text] - MySQL の設定するため上の指示通りにする。
[text]
hikosama-no-iMac:~ hikosama$ sudo vi /opt/local/etc/php5/php.ini
pdo_mysql.default_socket =/opt/local/var/run/mysql5/mysqld.sock
mysql.default_socket =/opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket =/opt/local/var/run/mysql5/mysqld.sock
[/text] - mbstring は別にインストールする。
[text]
hikosama-no-iMac:~ hikosama$ sudo port install php5-mbstring
Password:
—> Computing dependencies for php5-mbstring
—> Fetching php5-mbstring
—> Verifying checksum(s) for php5-mbstring
—> Extracting php5-mbstring
—> Configuring php5-mbstring
—> Building php5-mbstring
—> Staging php5-mbstring into destroot
—> Installing php5-mbstring @5.3.2_0
—> Activating php5-mbstring @5.3.2_0
—> Cleaning php5-mbstring
[/text] - httpd.conf に php5 モジュールを追加する。
[text]
hikosama-no-iMac:~ hikosama$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
[activating module `php5′ in /opt/local/apache2/conf/httpd.conf]
[/text] - httpd.conf に php の設定を追加する。
[text]
hikosama-no-iMac:~ hikosama$ sudo vi /opt/local/apache2/conf/httpd.conf
…
<IfModule php5_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
[/text] - httpd を再起動する。
[text]sudo /opt/local/apache2/bin/apachectl restart[/text]