IIS 7.5 に OpenPNE 3.4 のインストールを行ってみます。
※インストールする際、パスなどに関しては各自の環境に合わせて読み替えてください。
環境としては、下記の通りです。
- IIS 7.5 (URL Rewrite 1.1 x64 Japanese)
- PHP 5.2.12
- MySQL 5.1.42 x64
- OpenPNE 3.4(安定版)
上記の環境を整備する場合は、下記の内容等を御覧下さい。 (一部、たんたかさんの投稿です。)
※下記の「PHPのインストール」での、phpのバージョンは 5.3 での内容になります。
なお、URL Rewrite 1.1 のモジュールは下記の「IIS 7 - 拡張機能 ダウンロード ページ」にある「URL 書き換えモジュール」からダウンロードできます。
http://technet.microsoft.com/ja-jp/iis/dd742256.aspx
■1
下記のURLから「安定版【OpenPNE-3.4.0】」のZIP版をダウンロードします。
http://www.openpne.jp/pne-downloads/openpne3/#openpne-3.3-3.4
■2
ダウンロードしたZIPファイルを解凍して、「c:\inetpub\wwwroot」フォルダにコピーします。
■3
コピーしたOpenPNEのフォルダを、「OpenPNE3.4」にリネームします。
■4
php.iniで、下記の設定値等が有効になっていることを確認します。
- extension=php_mbstring.dll
- mbstring.language = Japanese
- mbstring.internal_encoding = UTF-8
- extension=php_pdo.dll
- extension=php_pdo_mysql.dll
- extension=php_gd2.dll
- extension=php_mysql.dll
- extension=php_mcrypt.dll
■5
「C:\Program Files\MySQL\MySQL Server 5.1」にある「my.ini」をエディタで開きます。
■6
87行目付近にある、MySQLのモード設定の箇所を探して、下記のように編集します。
# Set the SQL mode to strict
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
■7
「my.ini」の編集が完了したら保存して、「管理ツール」にある「サービス」を起動し「MySQL」を再起動します。
■8
「MySQL」サービスの再起動が完了したら、下記のコマンドを入力してMySQLに「openpne」データベースを作成します。
create database openpne default character set utf8;
■9
下記のコマンドを入力して、「Authenticated Users」グループに変更の権限を与えます。
cd C:\inetpub\wwwroot\openpne3.4
icacls apps /grant "Authenticated Users":(OI)(CI)(M)
icacls bin /grant "Authenticated Users":(OI)(CI)(M)
icacls config /grant "Authenticated Users":(OI)(CI)(M)
icacls data /grant "Authenticated Users":(OI)(CI)(M)
icacls i18n /grant "Authenticated Users":(OI)(CI)(M)
icacls lib /grant "Authenticated Users":(OI)(CI)(M)
icacls log /grant "Authenticated Users":(OI)(CI)(M)
icacls plugins /grant "Authenticated Users":(OI)(CI)(M)
icacls templates /grant "Authenticated Users":(OI)(CI)(M)
icacls test /grant "Authenticated Users":(OI)(CI)(M)
icacls .gitignore /grant "Authenticated Users":(M)
icacls symfony /grant "Authenticated Users":(M)
■10
コントロールパネル等から、システムのプロパティを開いて「詳細設定」タブの「環境変数」ボタンを選択します。
■11
「システム環境変数」にある「Path」を選択して、「php.exe」が存在するフォルダのパスを追加するように編集します。今回の私の環境では「c:\php\php.exe」となりますので、「c:\php」を変数に追加します。
■12
Pathを追加後、コマンドプロンプトから「path」コマンドを入力して、追加したパスが反映されているか確認します。反映されていない場合は、Windowsを再起動します。
■13
下記のコマンドを入力して、設定ファイルを2つ作成します。
cd c:\inetpub\wwwroot\OpenPNE3.4\config
copy ProjectConfiguration.class.php.sample ProjectConfiguration.class.php
copy OpenPNE.yml.sample OpenPNE.yml
■14
OpenPNE.yml をエディタで開いて、下記の項目を設定します。また、必要であれば他のsmtpの設定等を編集します。
| base_url: |
"http://example.com/" |
mail_domain:
|
"example.com" |
■15
下記のコマンドを入力して、OpenPNEのインストールをコマンドラインから行います。
cd C:\inetpub\wwwroot\openpne3.4
php symfony openpne:install
■16
正常にインストールが完了したら、下記のコマンドを入力して新規に作成された cache フォルダに対して「Authenticated Users」グループに変更の権限を与えます。
cd C:\inetpub\wwwroot\openpne3.4
icacls cache /grant "Authenticated Users":(OI)(CI)(M)
icacls web\cache /grant "Authenticated Users":(OI)(CI)(M)
■17
IISマネージャーを起動して、下図のように仮想ディレクトリを作成します。
■18
「C:\inetpub\wwwroot\openpne3.4\web」フォルダにある、「.htaccess」ファイルを開いて下記の内容をコピーします。コピー後、IISマネージャーの「OpenPNE」仮想ディレクトリを選択し「URL 書き換え」から「規則のインポート」を実行します。
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
また、空の規則を作成して、下記のような内容で規則を追加設定して順位を一番下にしておきます。
| パターン: |
^(.*)pc_backend.php/(.*)$ |
| アクション: |
書き換え |
| URLの書き換え: |
{R:1}pc_backend.php |
■19
「http://URI/OpenPNE/」にアクセスして、下記の初期アカウントを入力します。
| メールアドレス: |
sns@example.com |
| パスワード: |
password |
また、管理サイトに関しては「http://URI/OpenPNE/pc_backend.php」になります。
デフォルトのアカウント情報は下記の通りです。
| アカウント名: |
admin |
| パスワード: |
password |
■結果
