forked from fuel/docs
-
Notifications
You must be signed in to change notification settings - Fork 119
/
instructions.html
226 lines (184 loc) · 11.2 KB
/
instructions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./../assets/css/combined.css">
<link rel="shortcut icon" href="./../favicon.ico" />
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
var path = './../';
</script>
<script src="./../assets/js/combined.js"></script>
<title>インストール方法 - インストール - FuelPHP ドキュメント</title>
</head>
<body>
<div id="container">
<header id="header">
<div class="table">
<h1>
<strong>FuelPHP, a PHP 5.3 Framework</strong>
Documentation
</h1>
<form id="google_search">
<p>
<span id="search_clear"> </span>
<input type="submit" name="search_submit" id="search_submit" value="検索" />
<input type="text" value="" id="search_input" name="search_input" />
</p>
</form>
</div>
<nav>
<div class="clear"></div>
</nav>
<a href="#" id="toc_handle">目次</a>
<div class="clear"></div>
</header>
<div id="cse">
<div id="cse_point"></div>
<div id="cse_content"></div>
</div>
<div id="main">
<h5>いずれかを選択してください: <a href="#command">コマンドラインからインストール</a> | <a href="#manual">手動でインストール</a></h5>
<br />
<h3 id="command">コマンドラインからインストール</h3>
<p class="note">この方法は現在 *nix systems (Linux, OS X, Unix など) でのみ動作します。</p>
<p>我々のクイックインストーラは Oil パッケージ用に書き下ろされたインターフェースです。これを使用すると1つのコマンドで新しいプロジェクトを生成することができます。oil コマンドで 'php' を使用する必要もありません。</p>
<p>クイックインストーラをインストールするためには、シェルを開き次のコマンドを実行するだけです:</p>
<pre class="cli"><code>$ curl get.fuelphp.com/oil | sh</code></pre>
<p class="note">この場合、スクリプトを /usr/bin にインストールするためパスワードを尋ねてくるでしょう。</p>
<p>これであなたのプロジェクトでは 'php oil' の代わりに 'oil' だけを使用することができます。</p>
<p class="note">バージョン 1.6 以前の oil スクリプトをインストール済みの場合は、composer を実行させるために再度、インストールし直す必要があります!</p>
<p>新しいプロジェクトを作成するには単に以下を実行します:</p>
<pre class="cli"><code>$ oil create <project_name></code></pre>
<p>これで、カレントディレクトリにあなたが指定したプロジェクト名のフォルダが作成されます。そしてリポジトリとすべてのサブモジュールをそのフォルダに複製します。</p>
<p>
Note: これは、必要なディレクトリを書き込み可能にするための <code class="cli">$ oil refine install</code> も実行します。
そして、Composer により定義された依存ライブラリを取得する <code class="cli">$ php composer.phar update</code> も実行します。
</p>
<h3 id="manual">手動でインストール</h3>
<p>この方法は、あなたの Web サーバに Fuel フレームワークのデフォルトインストール構成を生成します。</p>
<h4 id="from_github">GitHub からクローンする</h4>
<pre class="cli"><code>$ cd /where/ever/your/webserver/root/is
$ git clone --recursive git://github.com/fuel/fuel.git
</code></pre>
<p>これは、あなたの Web サーバのルートに、FuelPHP のすべての Core パッケージを含む
<strong>fuel</strong> フォルダを作成します。</p>
<h4 id="from_zip">Zip ファイルをダウンロードする</h4>
<ol>
<li><a href="download.html">Fuel フレームワークをダウンロードする</a></li>
<li>ダウンロードしたファイルを解凍し、展開する</li>
<li>ファイルをサーバへ移動する
<ul>
<li>ソース内の public ディレクトリは Web サーバの公開用ディレクトリ、例えば、
public_html, public, htdocs など)になります。
その内容をそこへ移動するか
Fuel を使用したい webroot のサブディレクトリへ移動します。</li>
<li>fuel ディレクトリを公開ディレクトリの外に置くことをセキュリティの観点から推奨します。</li>
<li>index.php 内のパスを編集し、あなたの app, core, packages ディレクトリに合わせます。</li>
</ul>
<pre class="plain"><code>/
fuel/
app/
core/
packages/
public/
.htaccess
assets/
index.php
oil
</code></pre>
</li>
</ol>
<p>インストールの後は、フレームワークがアクセスする必要のあるフォルダのパーミッションが正しいことを確認してください。デフォルトのフォルダを書き込み可能にする
oil タスクが用意されています:</p>
<pre class="cli"><code>$ php oil refine install
Made writable: APPPATH/cache
Made writable: APPPATH/logs
Made writable: APPPATH/tmp
Made writable: APPPATH/config
</code>
</pre>
<h2 id="composer">Composer</h2>
<p>
バージョン 1.6 から、FuelPHP は <a href="http://getcomposer.org">Composer</a> パッケージマネージャを使い、 <a href="http://packagist.org">Packagist</a>、GitHub、または、独自に定義された場所から、
依存ライブラリを動的に取得します。
Composer は、FuelPHP をインストールしたルートにある composer.json ファイルによりコントロールされます。
便利なように、FuelPHP に composer.phar ライブラリを含めていますので、composer を直接実行することができます:
</p>
<pre class="cli"><code>$ php composer.phar self-update
php composer.phar update
</code>
</pre>
<p class="note">重要なフレームワークのコンポーネントが composer 経由でロードされるため、このステップを実行しないと、FuelPHP は起動しません!</p>
<h2 id="configuration">設定</h2>
<p>メインの設定は app/config/config.php にあります。好きに編集してください。</p>
<h2 id="install_inside_root">ドキュメントルート内にインストールする</h2>
<p>ポイント 3 で説明したように、セキュリティの観点から Web サーバのドキュメントルート内に Fuel をインストール <strong>しない</strong> ことを強く推奨します。</p>
<p>
しかしながらそうしたいケースもあります。例えば、Apache の大量の動的なバーチャルホストモジュールのある (ローカルの) 開発環境は、
Web サーバを再起動せずに新しい開発環境を素早く構築するために使用されます。
</p>
<p>
これが必要な場合、ルートと決めたフォルダに FuelPHP をインストールします。その後、publc フォルダに移動し、
すべてのファイルを 1つ上の階層に移動し、public フォルダを削除します。public フォルダの唯一の目的は、Web サーバのドキュメントルートのためのアンカーポイントを提供することです。
FuelPHP をドキュメントルートフォルダにインストールしたら、もはや必要ありません。
</p>
<p>これらの移動の後に、index.php の中のアプリケーションの位置を変更します:</p>
<pre class="php"><code>define('APPPATH', realpath(__DIR__.'/fuel/app/').DIRECTORY_SEPARATOR);</code></pre>
<h3 id="install_inside_root2">いくつかのフォルダをより深くするのはどうでしょう?</h3>
<p>違いはありません。手順はまったく同じです。</p>
<p>
しかしながら、この場合のアプリケーションへのアクセスは、フォルダ構成のため少々複雑になるかもしれません。同じフォルダ構成のまま移動したファイル群にそのままアクセスすることは、
従来の .htaccess ではできません。
</p>
<p>
FuelPHP がドキュメントルートの "/deep/sub/folder" にインストールされているとすると、通常ならば
http://example.org/deep/sub/folder でアプリケーションにアクセスする必要があります。
</p>
<p>
上位フォルダのどこかに以下の .htaccess を置くことで、存在しないファイルやディレクトリにアクセスがあった場合に、
あなたのアプリケーションにリダイレクトをさせることができます:</p>
<pre class="plain"><code><IfModule mod_rewrite.c>
RewriteEngine on
# 存在するファイルやフォルダでなかったり、ルートへのリクエストの場合、リクエストをサブフォルダに送る
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond $1 ^$
RewriteRule ^(.*)$ /deep/sub/folder [R=301,L]
</IfModule>
</code>
</pre>
<p>これはリダイレクトであることに注意してください。ユーザにサブフォルダを隠しません。もし、サブフォルダを隠したい場合は、代わりに以下を使ってください:</p>
<pre class="plain"><code><IfModule mod_rewrite.c>
RewriteEngine on
# 存在するファイルやフォルダでなかったり、ルートへのリクエストの場合、リクエストをサブフォルダに送る
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond $1 ^$
RewriteRule ^(.*)$ /deep/sub/folder [QSA,L]
</IfModule>
</code>
</pre>
<p>もちろん、もし "sub" フォルダに配置した場合は、URL から "sub/folder" を隠せますが、"deep" は隠せません...</p>
<h2 id="setting_the_environment">環境を設定する</h2>
<p>
デフォルトでは、環境は開発モードにセットされています。Fuel は環境を使用して、使用するデータベース設定を定義します。しかし、他のことにも利用できます。
</p>
<p>
環境を設定するために、.htaccess ファイルに次の行を追加します。
</p>
<pre class="plain"><code>SetEnv FUEL_ENV production</code></pre>
<p>
有効なオプションは Fuel クラスの <a href="../classes/fuel.html#class_constants">クラス定数</a> 内で定義されています。
</p>
</div>
<footer>
<p>
© FuelPHP Development Team 2010-2013 - <a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.
[ <a href="https://github.com/fuel/docs/commits/1.7/develop/installation/instructions.html">原文コミット履歴</a> | <a href="https://github.com/NEKOGET/FuelPHP_docs_jp/commits/1.7/develop_japanese/installation/instructions.html">翻訳コミット履歴</a> | <a href="https://github.com/NEKOGET/FuelPHP_docs_jp/blob/1.7/develop_japanese/installation/instructions.html">GitHubで修正</a> ]
</p>
</footer>
</div>
</body>
</html>