WAMP構築
Windows とのデュアルブート環境に戻すために Windows の再セットアップ。
その後悩んだが一先ず LAMP ではなく WAMP 環境を作ることにしたのでメモ。
MySQL
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67-win32.zip/from/pick からクライアントをダウンロードする。バージョンは 5.0.67 にした。
セットアップ手順は以下。
- standard Configuration
- install As Windows Service
- modify Security Setting のチェックを外す。
my.ini 編集
- 58行目 default-character-set=latin1
- > default-character-set=utf8
- 83行目 default-character-set=latin1
- > default-character-set=utf8
※この二つは日本語などで化けた場合には以前のように cp932 に変えてやる。
保存したら 管理ツール - サービス から MySQL を再起動する。
Apache
http://www.apache.jp/misc/download.html から手順に沿ってクライアントをダウンロードする。バージョンは 2.2 にした。ファイル名は (apache_2.2.9-win32-x86-no_ssl-r2.msi)
セットアップ手順は以下。
- Network Domain (e.g. somenet.com)
- hoge.orz (ローカルホストなので適当に)
- Server Name (e.g. www.somenet.com)
- localhost
- Administrator's Email Address (e.g. webmaster@somenet.com)
- admin@hoge.orz (適当)
- Install Apache HTTP Server 2.2 programs and shortcuts for
- for All Users, on Port 80, as a Service --Recommended.
- Setup Type
- Custom
- インストール場所
- D:\Apache2.2
セットアップが終了すると Apache が立ち上がるが、Port80 をすでに他のアプリケーションで使用していたため?にステータスが正常ではなかったので PC をリブートした。その後は問題なし。
PHP
http://www.php.net/get/php-5.2.6-Win32.zip/from/a/mirror からクライアントをダウンロードする。バージョンは 5.2.6 にした。
セットアップ手順は以下。
httpd.conf, php.ini 編集
php.ini
- 492行目 doc_root =
- > doc_root = "D:/www"
- 499行目 extension_dir = "./"
- > extension_dir = "D:/php/ext"
- 642行目 ;extension=php_mbstring.dll
- > extension=php_mbstring.dll (コメントアウトを外す)
- 649行目 ;extension=php_mysql.dll
- > extension=php_mysql.dll (コメントアウトを外す)
- 1222行目 ;mbstring.language = Japanese
- > mbstring.language = Japanese (コメントアウトを外す)
- 1227行目 ;mbstring.internal_encoding = EUC-JP
- > mbstring.internal_encoding = UTF-8
- 1230行目 ;mbstring.http_input = auto
- > mbstring.http_input = auto (コメントアウトを外す)
- 1234行目 ;mbstring.http_output = SJIS
- > mbstring.http_output = UTF-8
- 1241行目 ;mbstring.encoding_translation = Off
- > mbstring.encoding_translation = On
- 1245行目 ;mbstring.detect_order = auto
- > mbstring.detect_order = auto (コメントアウトを外す)
- 1249行目 ;mbstring.substitute_character = none;
- > mbstring.substitute_character = none; (コメントアウトを外す)
httpd.conf
- 127行目
- LoadModule php5_module D:/php/php5apache2_2.dll (追記)
- 178行目 DocumentRoot "D:/Apache2.2/htdocs"
- > DocumentRoot "D:/www"
- 205行目
- >
239〜243行目
<IfModule dir_module> DirectoryIndex index.html </IfModule>
を、以下に変更
<IfModule dir_module> DirectoryIndex index.html DirectoryIndex index.htm DirectoryIndex index.php </IfModule>
385行目〜
AddType application/x-compress .Z AddType application/x-gzip .gz .tgz
を、以下に変更
AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
すべて終了したら PC をリブート。
動作確認
http://localhost/ にアクセスして Apache の動作確認。
<?php phpinfo();?>
test.php などに保存して http://localhost/test.php で PHP の情報を確認。
MySQL CommandLine Client を開き
mysql> select version();
で MySQL のバージョン情報などを確認。