ずいぶん前に試した某所向けネタ。
# ぽしゃった(のか?)けれども(汗)。
まぁ、PHPが動いている環境に適用するなら小難しい事はございませんので。
前提
- VM上のFreeBSDに対してインストール(PHPは導入済み)
- WWWサーバはnginx
- IPアドレスは192.168.1.111
- ドキュメントルートは/usr/local/www/localip
FuelPHPの取得
公式Webサイトからアーカイブを拾ってくる。
或いは「FuelPHP入門」
[[amazon2][4881669419]]
のP.20に書いてある通りGit経由で拾ってくればOK。
せっかくなのでGit経由で拾ってみる事にして、まずはoilスクリプト(これはshellスクリプト)を拾ってくる。
[bash]
curl get.fuelphp.com/oil | sh
[/bash]
を実行。うまくいけば/usr/binにoilスクリプトが生成されているはず。
何をやっているかというと、下のようなスクリプトが降ってきてshに渡しているだけ。
[bash]
#!/bin/bash
PREFIX="/usr/bin/"
install_oil() {
if [ `which sudo` ]; then
sudo sh -c "curl –silent http://get.fuelphp.com/installer.sh > ${PREFIX}oil"
sudo chmod +x ${PREFIX}oil
else
sh -c "curl –silent http://get.fuelphp.com/installer.sh > ${PREFIX}oil"
chmod +x ${PREFIX}oil
fi
}
#
# Handle execution
#
main() {
# Start installation
install_oil
exit 0
}
main
[/bash]
installer.shは
[bash]
#!/bin/bash
if [ -f "./oil" ]; then
php oil "$@"
else
if [ "$1" == "create" ]; then
if [ ! `which git` ]; then
echo "For this installer to work you’ll need to install Git."
echo ‘ http://git-scm.com/’
fi
git clone –recursive git://github.com/fuel/fuel.git "./$2"
cd ./$2
branch=`git branch -a | grep -v "remote" | grep "master" | tail -1 | cut -d/ -f3-4`
git checkout $branch
git submodule foreach git checkout $branch
cd ..
php "./$2/oil" refine install
else
echo ‘This is not a valid Fuel installation so Oil is a bit lost.’
echo ‘ http://fuelphp.com/docs/installation/instructions.html’
fi
fi
[/bash]
こんな感じ。これがインストールされるoilスクリプト本体で/usr/binにインストールされる。
oilスクリプトの1行目を見るとお分かりだろうが、bash前提となっているので、bashがインストールされていないのであれば
[bash]
#!/bin/sh
[/bash]
に直して置くと吉。
oilコマンドがインストールできたらプロジェクトを作ってみる。
[bash]
oil create test
[/bash]
上記を実行すると
[bash]
Cloning into ‘./test’…
remote: Counting objects: 14697, done.
remote: Compressing objects: 100% (8718/8718), done.
remote: Total 14697 (delta 6135), reused 14240 (delta 5738)
Receiving objects: 100% (14697/14697), 4.30 MiB | 180 KiB/s, done.
Resolving deltas: 100% (6135/6135), done.
Submodule ‘docs’ (git://github.com/fuel/docs.git) registered for path ‘docs’
Submodule ‘fuel/core’ (git://github.com/fuel/core.git) registered for path ‘fuel/core’
Submodule ‘fuel/packages/auth’ (git://github.com/fuel/auth.git) registered for path ‘fuel/packages/auth’
Submodule ‘fuel/packages/email’ (git://github.com/fuel/email.git) registered for path ‘fuel/packages/email’
Submodule ‘fuel/packages/log’ (git://github.com/fuel/log.git) registered for path ‘fuel/packages/log’
Submodule ‘fuel/packages/oil’ (git://github.com/fuel/oil.git) registered for path ‘fuel/packages/oil’
Submodule ‘fuel/packages/orm’ (git://github.com/fuel/orm.git) registered for path ‘fuel/packages/orm’
Submodule ‘fuel/packages/parser’ (git://github.com/fuel/parser.git) registered for path ‘fuel/packages/parser’
Cloning into ‘docs’…
remote: Counting objects: 9070, done.
remote: Compressing objects: 100% (4678/4678), done.
remote: Total 9070 (delta 4712), reused 8538 (delta 4234)
Receiving objects: 100% (9070/9070), 3.71 MiB | 279 KiB/s, done.
Resolving deltas: 100% (4712/4712), done.
Submodule path ‘docs’: checked out ’87c90e374401f2e4d2f007ed6b1e2fa9263f2e92′
Cloning into ‘fuel/core’…
remote: Counting objects: 26634, done.
remote: Compressing objects: 100% (14798/14798), done.
remote: Total 26634 (delta 13399), reused 24430 (delta 11243)
Receiving objects: 100% (26634/26634), 7.82 MiB | 277 KiB/s, done.
Resolving deltas: 100% (13399/13399), done.
Submodule path ‘fuel/core’: checked out ‘880ff4a43e729ede7924f9d509a8ecc496d1dde0’
Cloning into ‘fuel/packages/auth’…
remote: Counting objects: 765, done.
remote: Compressing objects: 100% (495/495), done.
Receiving objects: 100% (765/765), 94.51 KiB | 83 KiB/s, done.
Resolving deltas: 100% (293/293), done.
remote: Total 765 (delta 293), reused 735 (delta 270)
Submodule path ‘fuel/packages/auth’: checked out ‘2b3fa6384477ce546b9953a7b8754de978ace8fc’
Cloning into ‘fuel/packages/email’…
remote: Counting objects: 491, done.
remote: Compressing objects: 100% (326/326), done.
Receiving objects: 100% (491/491), 71.43 KiB, done.
Resolving deltas: 100% (168/168), done.
remote: Total 491 (delta 168), reused 473 (delta 152)
Submodule path ‘fuel/packages/email’: checked out ‘0f97045d44165512d759973f5602c7b35471d157’
Cloning into ‘fuel/packages/log’…
remote: Counting objects: 148, done.
remote: Compressing objects: 100% (99/99), done.
Receiving objects: 100% (148/148), 80.46 KiB | 125 KiB/s, done.
Resolving deltas: 100% (42/42), done.
remote: Total 148 (delta 42), reused 145 (delta 39)
Submodule path ‘fuel/packages/log’: checked out ‘dab707c91a94bf32a92a9947b92782b46bc13308’
Cloning into ‘fuel/packages/oil’…
remote: Counting objects: 1535, done.
remote: Compressing objects: 100% (883/883), done.
Receiving objects: 100% (1535/1535), 211.37 KiB | 129 KiB/s, done.
Resolving deltas: 100% (705/705), done.
remote: Total 1535 (delta 705), reused 1421 (delta 601)
Submodule path ‘fuel/packages/oil’: checked out ‘e401c31e65b0a1bf165a9ecff14626eb611ea90f’
Cloning into ‘fuel/packages/orm’…
remote: Counting objects: 15189, done.
remote: Compressing objects: 100% (8238/8238), done.
remote: Total 15189 (delta 7049), reused 14832 (delta 6708)
Receiving objects: 100% (15189/15189), 3.96 MiB | 278 KiB/s, done.
Resolving deltas: 100% (7049/7049), done.
Submodule path ‘fuel/packages/orm’: checked out ’57e10250b0f6d08d4f60a192e7d27c468eea14d0′
Cloning into ‘fuel/packages/parser’…
remote: Counting objects: 872, done.
remote: Compressing objects: 100% (484/484), done.
Receiving objects: 100% (872/872), 183.26 KiB | 152 KiB/s, done.
Resolving deltas: 100% (331/331), done.
remote: Total 872 (delta 331), reused 851 (delta 315)
Submodule path ‘fuel/packages/parser’: checked out ‘593d93d0e4baf551ea14f59d8ecbba4ba6f28dea’
Entering ‘docs’
Entering ‘fuel/core’
Entering ‘fuel/packages/auth’
Entering ‘fuel/packages/email’
Entering ‘fuel/packages/log’
Entering ‘fuel/packages/oil’
Entering ‘fuel/packages/orm’
Entering ‘fuel/packages/parser’
Made writable: /root/test/fuel/app/cache
Made writable: /root/test/fuel/app/logs
Made writable: /root/test/fuel/app/tmp
Made writable: /root/test/fuel/app/config
[/bash]
こんな感じでプロジェクトが生成される。
今回は/usr/local/www/localipの下で実行したので、そこにtestというディレクトリが生成されていればOK。
nginxの設定
[text]
location /test/public {
index index.php index.html;
root /usr/local/www/localip;
if (!-e $request_filename) {
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /test/public/index.php last;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
[/text]
こんな感じでnginx.confに定義しておく。(rewriteでindex.phpを消していることに注意)
プロジェクトへのアクセス
ブラウザから192.168.1.111/test/public/welcome/indexにアクセス
のように表示されればインストール終了。
コメント
[…] >>FuelPHPをインストールしてみる。 | シカでした。 Author: […]