<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HASの庭 &#187; 備忘録</title>
	<atom:link href="http://has.s321.xrea.com/category/memo/feed/" rel="self" type="application/rss+xml" />
	<link>http://has.s321.xrea.com</link>
	<description>発酵to熟成の道</description>
	<lastBuildDate>Sun, 12 Nov 2023 15:30:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CakePHP ブログチュートリアル</title>
		<link>http://has.s321.xrea.com/memo/cakephp/875/</link>
		<comments>http://has.s321.xrea.com/memo/cakephp/875/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 09:17:48 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=875</guid>
		<description><![CDATA[
今更ですが、CakePHPの公式ブログチュートリアルをやってみました！
環境及びバージョン
・CentOS: 5.4
・CakePHP: 1.3.3
・MySQL: 5.0.77
ダウンロード

1
2
3
4
5
6
cd /tmp/
wget http://github.com/cakephp/cakephp/tarball/1.3.3
tar xvzf cakephp-cakephp-1.3.3-0-gf01b4ae.tar.gz -C /var/www/www.yourdomain.jp/
cd /var/www/www.yourdomain.jp
mv cakephp-cakephp-efb6e08 cakephp133
rm /tmp/cakephp-cakephp-1.3.3-0-gf01b4ae.tar.gz

Apacheの設定

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cd /etc/httpd/conf.d/
&#160;
vi ○○.conf
&#60;VirtualHost xxx.xxx.xxx.xxx:80&#62;
  ServerName www.yourdomain.jp:80
  DocumentRoot /var/www/www.yourdomain.jp/cakephp133
  ServerAdmin webmaster@yourdomain.jp
  ErrorLog logs/error_log-www.yourdomain.jp
  CustomLog logs/access_log-www.yourdomain.jp combined env=!no_log
&#60;/VirtualHost&#62;
&#60;Directory /var/www/www.yourdomain.jp/cakephp133&#62;
  AllowOverride All
  Options -MultiViews
  Order allow,deny
  Allow from all
&#60;/Directory&#62;
&#160;
service httpd configtest
service httpd restart

データベースの作成

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
CREATE DATABASE blog_test;
GRANT ALL  [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>今更ですが、CakePHPの公式ブログチュートリアルをやってみました！</p>
<p><strong>環境及びバージョン</strong><br />
・CentOS: 5.4<br />
・CakePHP: 1.3.3<br />
・MySQL: 5.0.77</p>
<p><span id="more-875"></span><strong>ダウンロード</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd /tmp/
wget http://github.com/cakephp/cakephp/tarball/1.3.3
tar xvzf cakephp-cakephp-1.3.3-0-gf01b4ae.tar.gz -C /var/www/www.yourdomain.jp/
cd /var/www/www.yourdomain.jp
mv cakephp-cakephp-efb6e08 cakephp133
rm /tmp/cakephp-cakephp-1.3.3-0-gf01b4ae.tar.gz</pre></td></tr></table></div>

<p><strong>Apacheの設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd /etc/httpd/conf.d/
&nbsp;
vi ○○.conf
&lt;VirtualHost xxx.xxx.xxx.xxx:80&gt;
  ServerName www.yourdomain.jp:80
  DocumentRoot /var/www/www.yourdomain.jp/cakephp133
  ServerAdmin webmaster@yourdomain.jp
  ErrorLog logs/error_log-www.yourdomain.jp
  CustomLog logs/access_log-www.yourdomain.jp combined env=!no_log
&lt;/VirtualHost&gt;
&lt;Directory /var/www/www.yourdomain.jp/cakephp133&gt;
  AllowOverride All
  Options -MultiViews
  Order allow,deny
  Allow from all
&lt;/Directory&gt;
&nbsp;
service httpd configtest
service httpd restart</pre></td></tr></table></div>

<p><strong>データベースの作成</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">CREATE DATABASE blog_test;
GRANT ALL PRIVILEGES ON blog_test.* TO 'test01'@'localhost' IDENTIFIED BY 'pass01';
&nbsp;
use blog_test;
CREATE TABLE posts (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(50),
    body TEXT,
    created DATETIME DEFAULT NULL,
    modified DATETIME DEFAULT NULL
);
&nbsp;
#サンプルデータ
INSERT INTO posts (title,body,created) VALUES ('タイトル', 'これは、記事の本文です。', NOW());
INSERT INTO posts (title,body,created) VALUES ('またタイトル', 'そこに本文が続きます。', NOW());
INSERT INTO posts (title,body,created) VALUES ('タイトルの逆襲', 'こりゃ本当に面白そう！うそ。', NOW());</pre></td></tr></table></div>

<p><strong>データベースの設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd app/config/
cp database.php.default database.php
&nbsp;
vi database.php
var $default = array(
    'driver' =&gt; 'mysql',
    'persistent' =&gt; false,
    'host' =&gt; 'localhost',
    'login' =&gt; 'test01',
    'password' =&gt; 'pass01',
    'database' =&gt; 'blog_test',
    'prefix' =&gt; '',
    'encoding' =&gt; 'utf8',
);</pre></td></tr></table></div>

<p><strong>その他の設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">#/tmpディレクトリを書き込めるようにする。
chown -R apache ../tmp
&nbsp;
#セキュリティ設定
vi core.php
Configure::write('Security.salt', 'ランダムな文字列');</pre></td></tr></table></div>

<p><strong>mod_rewriteの確認</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">LoadModule rewrite_module libexec/httpd/mod_rewrite.so
AddModule mod_rewrite.c
AllowOverride All</pre></td></tr></table></div>

<p><strong>Postモデルの作成</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd ../models
touch post.php
&nbsp;
vi post.php
&lt;?php
class Post extends AppModel
{
    var $name = 'Post';
&nbsp;
    var $validate = array(
        'title' =&gt; array(
            'rule' =&gt; array('minLength', 1)
        ),
        'body' =&gt; array(
            'rule' =&gt; array('minLength', 1)
        )
    );
}
?&gt;</pre></td></tr></table></div>

<p><strong>Postコントローラの作成</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd ../controllers
touch posts_controller.php
&nbsp;
vi posts_controller.php
&lt;?php
class PostsController extends AppController {
    var $name = 'Posts';
&nbsp;
    //記事の一覧
    function index() {
        $this-&gt;set('posts', $this-&gt;Post-&gt;find('all'));
    }
    //記事の表示
    function view($id = null) {
        $this-&gt;Post-&gt;id = $id;
        $this-&gt;set('post', $this-&gt;Post-&gt;read());
    }
    //記事の追加
    function add() {
        if (!empty($this-&gt;data)) {
            if ($this-&gt;Post-&gt;save($this-&gt;data)) {
                $this-&gt;flash('Your post has been saved.','/posts');
            }
        }
    }
    //記事の削除
    function delete($id) {
        $this-&gt;Post-&gt;delete($id);
        $this-&gt;flash('The post with id: '.$id.' has been deleted.', '/posts');
    }
    //記事の編集
    function edit($id = null) {
        $this-&gt;Post-&gt;id = $id;
        if (empty($this-&gt;data)) {
            $this-&gt;data = $this-&gt;Post-&gt;read();
        } else {
            if ($this-&gt;Post-&gt;save($this-&gt;data['Post'])) {
                $this-&gt;flash('Your post has been updated.','/posts');
            }
        }
    }
}
?&gt;</pre></td></tr></table></div>

<p><strong>Postビューの作成</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd ../views
mkdir posts
cd posts
touch index.ctp
touch view.ctp
touch add.ctp
touch edit.ctp
&nbsp;
vi index.ctp
&lt;h1&gt;Blog posts&lt;/h1&gt;
&lt;p&gt;&lt;?php echo $html-&gt;link(&quot;Add Post&quot;, &quot;/posts/add&quot;); ?&gt;&lt;/p&gt;
&lt;table&gt;
    &lt;tr&gt;
        &lt;th&gt;Id&lt;/th&gt;
        &lt;th&gt;Title&lt;/th&gt;
        &lt;th&gt;Created&lt;/th&gt;
    &lt;/tr&gt;
    &lt;!-- ここから、$posts配列をループして、投稿記事の情報を表示 --&gt;
    &lt;?php foreach ($posts as $post): ?&gt;
    &lt;tr&gt;
        &lt;td&gt;&lt;?php echo $post['Post']['id']; ?&gt;&lt;/td&gt;
        &lt;td&gt;
            &lt;?php echo $html-&gt;link($post['Post']['title'],'/posts/view/'.$post['Post']['id']);?&gt;
            &lt;?php echo $html-&gt;link(
                'Delete',
                &quot;/posts/delete/{$post['Post']['id']}&quot;, 
                null,
                'Are you sure?'
            )?&gt;
            &lt;?php echo $html-&gt;link('Edit', '/posts/edit/'.$post['Post']['id']);?&gt;
        &lt;/td&gt;
        &lt;td&gt;
        &lt;td&gt;
            &lt;?php echo $post['Post']['created']; ?&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;?php endforeach; ?&gt;
&lt;/table&gt;
&nbsp;
vi view.ctp
&lt;h1&gt;&lt;?php echo $post['Post']['title']?&gt;&lt;/h1&gt;
&lt;p&gt;&lt;small&gt;Created: &lt;?php echo $post['Post']['created']?&gt;&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php echo $post['Post']['body']?&gt;&lt;/p&gt;
&nbsp;
vi add.ctp
&lt;h1&gt;Add Post&lt;/h1&gt;
&lt;?php
echo $form-&gt;create('Post');
echo $form-&gt;input('title');
echo $form-&gt;input('body', array('rows' =&gt; '3'));
echo $form-&gt;end('Save Post');
?&gt;
&nbsp;
vi edit.ctp
&lt;h1&gt;Edit Post&lt;/h1&gt;
&lt;?php
    echo $form-&gt;create('Post', array('action' =&gt; 'edit'));
    echo $form-&gt;input('title');
    echo $form-&gt;input('body', array('rows' =&gt; '3'));
    echo $form-&gt;input('id', array('type'=&gt;'hidden')); 
    echo $form-&gt;end('Save Post');
?&gt;</pre></td></tr></table></div>

<p><strong>ルーティング</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">cd ../../config
vi routes.php
//Router::connect('/', array('controller' =&gt; 'pages', 'action' =&gt; 'display', 'home'));
Router::connect ('/', array('controller'=&gt;'posts', 'action'=&gt;'index'));</pre></td></tr></table></div>

<p><strong>表示確認</strong></p>
<p>http://www.yourdodmain.jp/</p>
<p><center><a href="http://has.s321.xrea.com/wp-content/uploads/2010/07/blog.gif"><img src="http://has.s321.xrea.com/wp-content/uploads/2010/07/blog.gif" alt="" title="blogチュートリアル" width="518" height="216" class="aligncenter size-full wp-image-877" /></a></center></p>
<p>はい、記事の閲覧、追加、編集、削除、すべて正しく動作しました～！ (^_^)/~</p>
<p>(2022/06/01) トラックバックも一時無効にしました。<br />
(2022/01/29) コメントスパムが多くなりましたので、コメントの投稿を一時無効にしました。</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/cakephp/875/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter ログイン認証（DX Auth）の導入</title>
		<link>http://has.s321.xrea.com/memo/codeigniter/597/</link>
		<comments>http://has.s321.xrea.com/memo/codeigniter/597/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 16:02:43 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[DX Auth]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=597</guid>
		<description><![CDATA[
CodeIgniterでログイン認証を構築してみます。いろいろな種類があるみたいですが、
「更新が止まっていない」、「ドキュメントがしっかりしている」などの理由から、DX Authを採用してみたいと思います。
環境及び [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>CodeIgniterでログイン認証を構築してみます。いろいろな種類があるみたいですが、<br />
「更新が止まっていない」、「ドキュメントがしっかりしている」などの理由から、DX Authを採用してみたいと思います。</p>
<p><strong>環境及びバージョン</strong><br />
・CodeIgniter: 1.7.2-1<br />
・DX Auth: 1.0.6</p>
<p><span id="more-597"></span><strong>ダウンロード</strong><br />
・「<a href="http://dexcell.shinsengumiteam.com/dx_auth/installation/downloads.html" target="_blank">公式サイト</a>」から、DX Authの最新版をダウンロード。</p>
<p><strong>インストール</strong><br />
<a href="http://dexcell.shinsengumiteam.com/dx_auth/installation/downloads.html" target="_blank">Installation Instructions（公式マニュアル）</a>を参考に、インストールを進めます。<br />
今回はバンドル版をインストールします。（他、ライブラリのみインストールする手順も書いてあります。）</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd /var/www/html/ci172ja  &lt;= ドキュメントルート（環境による）
$ mkdir tmp
$ cd tmp
$ cp /tmp/dx_auth-1.0.6.zip .
$ unzip dx_auth-1.0.6.zip
$ cp -r captcha ../
$ cp -r application ../system/
$ mysql -uUSERNAME -pPASSWD DBNAME &lt; schema.sql
$ cd ..
$ rm -fr tmp
$ vi system/application/config/config.php
$config['sess_use_database']    = TRUE;  &lt;= 変更</pre></td></tr></table></div>

<p><strong>ブラウザで表示確認 (1)</strong><br />
<a href="http://dexcell.shinsengumiteam.com/dx_auth/general/index.html" target="_blank">Getting Started（公式マニュアル）</a>を参考に表示確認を進めてみます。</p>
<p>ここで問題が発生してしまいました。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">http://www.yourhost.com/auth/login  =&gt; 表示されない
http://www.yourhost.com/index.php/auth/login  =&gt; 表示される</pre></td></tr></table></div>

<p>あえてクエリ文字列を表示する場合は別として、URLに「index.php」が残るのはスマートじゃぁないです。（*_*）</p>
<p>調べてみると、どうやらこれはCodeIgniterの仕様のようでした。（私の経験不足w）<br />
<a href="http://codeigniter.jp/user_guide_ja/general/urls.html">CodeIgniter の URL（公式マニュアル）</a>を参考に、.htaccessを設置してみます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]</pre></td></tr></table></div>

<p>はい、これで解消されました！<br />
でも、これって例外ページが増えるたびに.htaccessを更新しないといけないの？<br />
まぁいいか、運用でカバーできるならばw あ、そもそもサブディレクトリに設置すればいいのか！<br />
などと考えつつ、気を取り直して表示確認へ戻りたいと思います。</p>
<p><strong>httpd.confへ記入する場合の例</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond $1 !^/(index\.php|images|robots\.txt)
  RewriteRule ^/index.php/(.*)$ http://%{HTTP_HOST}/$1 [L,R]
  RewriteRule ^(.*)$ /index.php/$1 [L]
&lt;/IfModule&gt;</pre></td></tr></table></div>

<p><strong>ブラウザで表示確認 (2)</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">http://www.yourhost.com/auth/login/ to login.
http://www.yourhost.com/auth/logout/ to logout.
http://www.yourhost.com/auth/register/ to register.
http://www.yourhost.com/auth/register_recaptcha/ to register using reCAPTCHA.
http://www.yourhost.com/auth/forgot_password/ to use forgot password feature.
http://www.yourhost.com/auth/change_password/ to change password after you logged in.
http://www.yourhost.com/auth/cancel_account/ to delete account after you logged in.
http://www.yourhost.com/backend/users/ to manage users.
http://www.yourhost.com/backend/unactivated_users/ to manage unactivated users.
http://www.yourhost.com/backend/roles/ to manage roles.
http://www.yourhost.com/backend/uri_permissions/ to manage URI permissions.
http://www.yourhost.com/backend/custom_permissions/ to manage custom permissions.</pre></td></tr></table></div>

<p>とりあえず、全て表示されました。なんか機能豊富ですね！<br />
全体を通しての動作確認は、また別途行うという事にしたいですが、<br />
ReCAPTCHAの設定とかセキュリティ対策とかも残っていますね。</p>
<p>それでは、また～ (^^)/~</p>
<p>(2022/01/29) コメントスパムが多くなりましたので、コメント・トラックバックを一時無効にしました。</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/codeigniter/597/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter インストール (2)</title>
		<link>http://has.s321.xrea.com/memo/codeigniter/589/</link>
		<comments>http://has.s321.xrea.com/memo/codeigniter/589/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 10:55:02 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=589</guid>
		<description><![CDATA[
どうも日本語化オールインワンパックで不具合（原因は違うかもしれませんが）があるような、
なので、通常の手順からのインストールする方法も明記しておきます。
環境及びバージョン
・CodeIgniter: 1.7.2-1
 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>どうも日本語化オールインワンパックで不具合（原因は違うかもしれませんが）があるような、<br />
なので、通常の手順からのインストールする方法も明記しておきます。</p>
<p><strong>環境及びバージョン</strong><br />
・CodeIgniter: 1.7.2-1<br />
・ci-ja: 1.7.2-1</p>
<p><span id="more-589"></span><strong>ダウンロード</strong><br />
・「<a href="http://codeigniter.com/" target="_blank">公式サイト</a>」から、CodeIgniterの最新版をダウンロード。<br />
・「<a href="http://sourceforge.jp/projects/codeigniter/releases/" target="_blank">CodeIgniter日本語化</a>」のサイトから、ci-jaの同バージョンをダウンロード。</p>
<p><strong>日本語化 => FTPでアップ</strong><br />
・両方のファイルを解凍して、CodeIgniterへ日本語化ファイルを上書きする。<br />
・FTPで適当なディレクトリ（又はドキュメントルート）へ送信する。</p>
<p>～ ここから下は「インストール（１）」の手順と同じです ～</p>
<p><strong>基本設定</strong><br />
ベースURLと暗号鍵を設定する。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd /var/www/html/ci172ja/system
$ vi application/config/config.php
&nbsp;
$config['base_url']     = &quot;http://www.yourhost.com/&quot;;  &lt;= 変更
$config['encryption_key'] = &quot;xxxxxxxxxx&quot;;  &lt;= 変更</pre></td></tr></table></div>

<p><strong>データベース設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ vi application/config/database.php
&nbsp;
$db['default']['hostname'] = &quot;localhost&quot;;
$db['default']['username'] = &quot;ユーザ名&quot;;
$db['default']['password'] = &quot;パスワード&quot;;
$db['default']['database'] = &quot;DB名&quot;;
$db['default']['dbdriver'] = &quot;mysql&quot;;  &lt;= 環境に応じて</pre></td></tr></table></div>

<p><strong>セキュリティ設定</strong><br />
必要に応じて、systemディレクトリをリネームする。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd ..
$ mv system system-secret  &lt;= 実際には想像されにくいディレクトリ名で！
$ vi index.php
&nbsp;
$system_folder = &quot;system-secret&quot;;  &lt;= 上記で設定したディレクトリ名で！</pre></td></tr></table></div>

<p><strong>ブラウザで表示</strong></p>
<p>http://www.yourhost.com/ci172ja/</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">CodeIgniterへようこそ!
今ご覧のこのページは、CodeIgniterによって動的に生成されました。
このページを編集したい場合は、次の場所にあります:
system/application/views/welcome_message.php
このページのコントローラは次の場所にあります:
system/application/controllers/welcome.php
CodeIgniterを使うのが初めてなら、ユーザガイドを読むことから始めてください。
このページは、0.0104 秒でレンダリングされました。</pre></td></tr></table></div>

<p>と、表示されればインストール成功のようです。早速、ユーザーズガイドを確認しましょう！</p>
<p>http://www.yourhost.com/ci172ja/user_guide_ja/</p>
<p>(2022.07.12) コメントスパム対策のため、この投稿へのコメントとトラックバックを一時的に停止させていただきました。m(_ _)m</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/codeigniter/589/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CodeIgniter インストール (1)</title>
		<link>http://has.s321.xrea.com/memo/codeigniter/575/</link>
		<comments>http://has.s321.xrea.com/memo/codeigniter/575/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 08:08:05 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=575</guid>
		<description><![CDATA[
という事で、早速、インストールしてみました！
環境及びバージョン
・CodeIgniter: ci-ja-all-in-one-1.7.2-1
ダウンロード
「日本語言語パック」のサイトから、日本語化されたオールインパ [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>という事で、早速、インストールしてみました！</p>
<p><strong>環境及びバージョン</strong><br />
・CodeIgniter: ci-ja-all-in-one-1.7.2-1</p>
<p><span id="more-575"></span><strong>ダウンロード</strong><br />
「<a href="http://sourceforge.jp/projects/codeigniter/releases/" target="_blank">日本語言語パック</a>」のサイトから、日本語化されたオールインパックをダウンロード。</p>
<p><strong>ドキュメントルートへ設置</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ unzip ci-ja-all-in-one-1.7.2-1.zip
$ mv ci-ja-all-in-one-1.7.2-1 /var/www/html/ci172</pre></td></tr></table></div>

<p><strong>基本設定</strong><br />
ベースURLと暗号鍵を設定する。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd /var/www/html/ci172/system
$ vi application/config/config.php
&nbsp;
$config['base_url']     = &quot;http://www.yourhost.com/&quot;;  &lt;= 変更
$config['encryption_key'] = &quot;xxxxxxxxxx&quot;;  &lt;= 変更</pre></td></tr></table></div>

<p><strong>データベース設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ vi application/config/database.php
&nbsp;
$db['default']['hostname'] = &quot;localhost&quot;;
$db['default']['username'] = &quot;ユーザ名&quot;;
$db['default']['password'] = &quot;パスワード&quot;;
$db['default']['database'] = &quot;DB名&quot;;
$db['default']['dbdriver'] = &quot;mysql&quot;;  &lt;= 環境に応じて</pre></td></tr></table></div>

<p><strong>セキュリティ設定</strong><br />
必要に応じて、systemディレクトリをリネームする</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd ..
$ mv system system-secret  &lt;= 実際には想像されにくいディレクトリ名で！
$ vi index.php
&nbsp;
$system_folder = &quot;system-secret&quot;;  &lt;= 上記で設定したディレクトリ名で！</pre></td></tr></table></div>

<p><strong>ブラウザで表示</strong></p>
<p>http://www.yourhost.com/ci172/</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">CodeIgniterへようこそ!
今ご覧のこのページは、CodeIgniterによって動的に生成されました。
このページを編集したい場合は、次の場所にあります:
system/application/views/welcome_message.php
このページのコントローラは次の場所にあります:
system/application/controllers/welcome.php
CodeIgniterを使うのが初めてなら、ユーザガイドを読むことから始めてください。
このページは、0.0104 秒でレンダリングされました。</pre></td></tr></table></div>

<p>と、表示されればインストール成功のようです。ユーザーズガイドを確認しましょう！</p>
<p>http://www.yourhost.com/ci172/user_guide_ja/</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/codeigniter/575/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter という軽量フレームワーク</title>
		<link>http://has.s321.xrea.com/memo/codeigniter/549/</link>
		<comments>http://has.s321.xrea.com/memo/codeigniter/549/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 07:07:57 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=549</guid>
		<description><![CDATA[
こんな素敵なフレームワークが存在していたのですね。お恥ずかしながら知りませんでした。
少し調べてみると、Ruby on RailsやCakePHPと比べて、「軽量」＆「導入が容易」という事じゃないですか！
ある程度は自 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>こんな素敵なフレームワークが存在していたのですね。お恥ずかしながら知りませんでした。<br />
少し調べてみると、Ruby on RailsやCakePHPと比べて、「軽量」＆「導入が容易」という事じゃないですか！<br />
ある程度は自分で作りこみたい自分としては「ガチガチじゃないルール」というところも気に入りました。</p>
<p><span id="more-549"></span><strong>基本サイト</strong><br />
・<a href="http://codeigniter.com/" target="_blank">codeigniter.com（公式サイト）</a><br />
・<a href="http://sourceforge.jp/projects/codeigniter/releases/" target="_blank">日本語言語パック</a><br />
・<a href="http://codeigniter.jp/" target="_blank">日本CodeIgniterユーザ会</a><br />
・<a href="http://codeigniter.jp/user_guide_ja/" target="_blank">CodeIgniter ユーザズガイド 日本語版</a></p>
<p>SE兼PG１名というプロジェクト（自分ですか？）には最適ですね。日本語マニュアルもしっかりとある事ですし、<br />
最近、小回り系プロジェクト（なんじゃそりゃ！？）が多いので、試してみて良かったら採用してみようかな、と思いました。<br />
ちょっと気になるのは、php4で書かれているという事ですが、どうなんでしょう？！</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/codeigniter/549/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails アプリの自動生成</title>
		<link>http://has.s321.xrea.com/memo/ruby_on_rails/516/</link>
		<comments>http://has.s321.xrea.com/memo/ruby_on_rails/516/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 01:03:09 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[scaffold]]></category>
		<category><![CDATA[チュートリアル]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=516</guid>
		<description><![CDATA[
Ruby on Railsの本領発揮！
scaffoldジェネレータを使って、アプリ開発の足場作りをしてみます。今回はToDoリストを作成してみます。
環境及びバージョン
・Ruby: 1.8.7-p174
・Rail [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>Ruby on Railsの本領発揮！<br />
scaffoldジェネレータを使って、アプリ開発の足場作りをしてみます。今回はToDoリストを作成してみます。</p>
<p><strong>環境及びバージョン</strong><br />
・Ruby: 1.8.7-p174<br />
・Rails: 2.3.5</p>
<p><span id="more-516"></span><strong>scaffoldジェネレータ</strong><br />
プロジェクトのディレクトリ内で以下を実行します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ ruby script/generate scaffold Todo title:string description:text due:datetime done:boolean</pre></td></tr></table></div>

<p>・モデルクラスのソース<br />
・RHTMLテンプレート（ビュー）<br />
・コントローラのソース<br />
が、一括作成されました。</p>
<p><strong>テーブルの作成</strong><br />
テーブルを定義するマイグレーションファイルも作成されましたので、Railsが利用するテーブルを作成します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ rake db:migrate</pre></td></tr></table></div>

<p><strong>表示確認</strong><br />
動作環境によっては、開発用サーバを起動します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ ruby script/server</pre></td></tr></table></div>

<p>こちらも環境によりますが、ブラウザで表示確認をしてみます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">http://localhost:3000/todos
http://www.yourhost.com/projectname/todos</pre></td></tr></table></div>

<p><strong>ルーティングの設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ vi configs/routes.rb
map.root :controller =&gt; &quot;todos&quot;  &lt;=を追加する
$ rm public/index.html</pre></td></tr></table></div>

<p>すると</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">http://localhost:3000/
http://www.yourhost.com/projectname/</pre></td></tr></table></div>

<p>でも、リストページが表示される。</p>
<p><strong>アプリケーションの仕様</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">・最初のページでは、ToDoのリスト（一覧）が表示されます。
・「New todo」は、ToDo追加ページへ遷移します。
・「Show」は、対象ToDoの閲覧ページへ遷移します。
・「Edit」は、対象ToDoの編集ページへ遷移します。
・「Destroy」は、対象ToDoの削除ページへ遷移します。</pre></td></tr></table></div>

<p>※本手順は「Railsレシピブック183の技」を参考に若干修正を加えています。</p>
<p>この後、生成したアプリの機能や見た目を充実させていくんだそうです。<br />
ここまではアッという間ですねー(^_^)/~</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/ruby_on_rails/516/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails プロジェクトの作成</title>
		<link>http://has.s321.xrea.com/memo/ruby_on_rails/475/</link>
		<comments>http://has.s321.xrea.com/memo/ruby_on_rails/475/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 05:39:01 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=475</guid>
		<description><![CDATA[
開発用プロジェクトを作成する場合の最初の手順です。
環境及びバージョン
・CentOS: 5.4
・Ruby: 1.8.7-p174
・Rails: 2.3.5
・MySQL: 5.0.77
VirtualHostの設 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>開発用プロジェクトを作成する場合の最初の手順です。</p>
<p><strong>環境及びバージョン</strong><br />
・CentOS: 5.4<br />
・Ruby: 1.8.7-p174<br />
・Rails: 2.3.5<br />
・MySQL: 5.0.77</p>
<p><span id="more-475"></span><strong>VirtualHostの設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd /etc/httpd/conf.d
$ vi vir-www.yourhost.com.conf
&lt;VirtualHost xxx.xxx.xxx.xx:80&gt;
  ServerName www.yourhost.com:80
  DocumentRoot /var/www/www.yourhost.com/html
  RailsEnv development
  RailsBaseURI /rails
&lt;/VirtualHost&gt;
&lt;Directory /var/www/www.yourhost.com/html&gt;
  AllowOverride All
  Options -MultiViews
  Order allow,deny
  Allow from all
&lt;/Directory&gt;
&nbsp;
$ /etc/rc.d/init.d/httpd configtest
$ /etc/rc.d/init.d/httpd reload</pre></td></tr></table></div>

<p><strong>開発用プロジェクトの作成</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd /var/www/www.yourhost.com
$ rails -d mysql projectname
$ cd html
$ sudo -u apache ln -s ../projectname/public /tmp/projectname
$ mv /tmp/projectname .
$ cd ..</pre></td></tr></table></div>

<p><strong>データベースの設定</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ vi config/database.yml
  development:
    adapter: mysql
    encoding: utf8
    reconnect: false
    database: [開発用のDB名]
    pool: 5
    username: [ユーザ名]
    password: [パスワード]
    socket: /var/lib/mysql/mysql.sock</pre></td></tr></table></div>

<p><strong>表示確認</strong><br />
http://www.yourhost.com/projectname/ を表示して、<br />
「About your application&#8217;s environment」をクリックしてみる。</p>
<p>以下のようにスルッと表示されたらOK</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">Ruby version 1.8.7 (i686-linux) 
RubyGems version 1.3.5 
Rack version 1.0 
Rails version 2.3.5 
Active Record version 2.3.5 
Active Resource version 2.3.5 
Action Mailer version 2.3.5 
Active Support version 2.3.5 
Application root /var/www/www.yourhost.com/projectname 
Environment development 
Database adapter mysql 
Database schema version 20091214021526</pre></td></tr></table></div>

<p>以下のように表示されたらNG</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.</pre></td></tr></table></div>

<p>どうしてもNGになる場合は、<br />
・VirtualHost設定の「RailsEnv development」ディレクティブが抜けている<br />
・apacheをリスタートするとOKになる場合がある<br />
を、試してみてください。</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/ruby_on_rails/475/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress-2.8.6-ja 再構築</title>
		<link>http://has.s321.xrea.com/memo/wordpress/316/</link>
		<comments>http://has.s321.xrea.com/memo/wordpress/316/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 07:22:12 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[XREA]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=316</guid>
		<description><![CDATA[
プラグインを色々と試しては消したりしたのがいけないのか、どうしてもphpエラーが消せなくなってしまいましたので、
WordPressを、現時点の最新版（2.8.6-ja）へ再構築してみました。
サーバー環境
レンタル業 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line"　width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>プラグインを色々と試しては消したりしたのがいけないのか、どうしてもphpエラーが消せなくなってしまいましたので、<br />
WordPressを、現時点の最新版（2.8.6-ja）へ再構築してみました。</p>
<p><strong>サーバー環境</strong><br />
レンタル業者: <a title="XREA" href="http://www.xrea.com/" target="_blank">XREA</a><br />
Apache: 1.3.37<br />
PHP: 5.2.5<br />
MySQL: 5.1.22</p>
<p><span id="more-316"></span><strong>最新版をダウンロード</strong><br />
・<a title="WordPress日本語サイト" href="http://ja.wordpress.org/" target="_blank">WordPress日本語サイト</a>よりダウンロードする<br />
wordpress-2.8.6-ja.zip</p>
<p><strong>バックアップ</strong><br />
・全ての投稿をエクスポート<br />
・テーマ情報をメモる<br />
・プラグイン情報をメモる<br />
・パーマリンク設定をメモる<br />
・ユーザ情報をメモる</p>
<p><strong>削除</strong><br />
・FTPでWordPressファイル一式の削除<br />
・データベースごと削除</p>
<p><strong>再構築</strong><br />
・あらためてWordPress日本版をサーバへアップロード<br />
・データベースの作成<br />
・トップページよりセットアップを開始<br />
・ユーザを作成<br />
・投稿バックアップをインポート<br />
・パーマリンクの設定<br />
・カテゴリーの調整（日本語のスラッグが戻らない場合がある）<br />
・タグの調整（日本語のスラッグが戻らない場合がある）<br />
・Hello world!の投稿を削除<br />
・作られたaboutページを削除して、about-2ページのパーマリンクをaboutへ戻す<br />
・テーマの適用<br />
・プラグインのインストールと設定</p>
<p>ザッと！こんなもんでしょうか、いちおうPHPエラーも解消されるようになりました。<br />
細かい所は、気がついたら都度修正してゆくという事で、、、(^_^;)/</p>
<p>(2022/01/29) コメントスパムが多くなりましたので、コメントの投稿を一時無効にしました。</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/wordpress/316/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails CentOS5.4へのインストール</title>
		<link>http://has.s321.xrea.com/memo/ruby_on_rails/258/</link>
		<comments>http://has.s321.xrea.com/memo/ruby_on_rails/258/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 09:42:23 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=258</guid>
		<description><![CDATA[
色々試しましたが、結果、ソースからコンパイルしてインストールする事にしました。
環境及びバージョン
・CentOS: 5.4
・Ruby: 1.8.7-p174
・Gem: 1.3.5
・Rails: 2.3.5
・M [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>色々試しましたが、結果、ソースからコンパイルしてインストールする事にしました。</p>
<p><strong>環境及びバージョン</strong><br />
・CentOS: 5.4<br />
・Ruby: 1.8.7-p174<br />
・Gem: 1.3.5<br />
・Rails: 2.3.5<br />
・MySQL: 5.0.77</p>
<p><span id="more-258"></span><strong>事前準備</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ yum install gcc* compat-gcc* compat-lib*
$ yum groupinstall 'Development Libraries'
$ yum install git</pre></td></tr></table></div>

<p><strong>zlibライブラリの確認</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ yum list installed *zlib*
Installed Packages
zlib.i386                1.2.3-3              installed
zlib-devel.i386          1.2.3-3              installed</pre></td></tr></table></div>

<p><strong>rubyのインストール</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
$ tar zxvf ruby-1.8.7-p174.tar.gz
$ cd ruby-1.8.7-p174
$ ./configure --prefix=/usr
$ make
$ make install
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]</pre></td></tr></table></div>

<p><strong>iconv-rubyのインストール</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ cd ext/iconv/
$ ruby extconf.rb --with-iconv-dir=/usr/local
$ make
$ make install</pre></td></tr></table></div>

<p><strong>RubyGemのインストール</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
$ tar zxfv rubygems-1.3.5.tgz
$ cd rubygems-1.3.5
$ ruby setup.rb
$ gem -v
1.3.5</pre></td></tr></table></div>

<p><strong>Railsのインストール</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ gem install rails -v=2.2.2
$ gem list rails
*** LOCAL GEMS ***
rails (2.2.2)</pre></td></tr></table></div>

<p><strong>MySQLアダプタのインストール</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ gem install mysql -- --with-mysql-config=/usr/bin/mysql_config</pre></td></tr></table></div>

<p><strong>各アップデート（任意）</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ gem update --system
$ gem update
$ gem cleanup</pre></td></tr></table></div>

<p><strong>apacheへPassenger(mod_ruby)の組み込み(1)</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ gem install passenger
$ passenger-install-apache2-module
数回[Enter]
...
Please edit your Apache configuration file, and add these lines:
の下に、Passengerモジュールを組み込む為の表示がされる。
...
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
の下に、VirtualHostの設定例が表示される。</pre></td></tr></table></div>

<p><strong>apacheへPassenger(mod_ruby)の組み込み(2)</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ vi /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7
PassengerRuby /usr/bin/ruby</pre></td></tr></table></div>

<p><strong>VirtualHost設定のサンプル</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ vi /etc/httpd/conf.d/vir-www.yourhost.com.conf
ServerName www.yourhost.com
DocumentRoot /somewhere/html  # be sure to point to 'public'!
RailsEnv development  #  開発の場合
#RailsBaseURI /  # ルートで稼動させる場合
RailsBaseURI /sub  # サブディレクトリで稼動させる場合
&nbsp;
AllowOverride all  # relax Apache security settings
Options -MultiViews  # MultiViews must be turned off</pre></td></tr></table></div>

<p><strong>設定の反映</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">$ /etc/rc.d/init.d/httpd configtest
$ /etc/rc.d/init.d/httpd reload</pre></td></tr></table></div>

<p>こんな感じです～、(^_^)/~</p>
<p>(2022/05/01) コメントスパムが多くなりましたので、コメントの投稿を一時無効にしました。<br />
(2022/11/26) Trackbackも一時無効にしました。</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/ruby_on_rails/258/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress2.7 Google向けSiteMapプラグイン</title>
		<link>http://has.s321.xrea.com/memo/wordpress/197/</link>
		<comments>http://has.s321.xrea.com/memo/wordpress/197/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 17:50:10 +0000</pubDate>
		<dc:creator>HAS</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://has.s321.xrea.com/?p=197</guid>
		<description><![CDATA[
SEO対策として、検索エンジン向けのSiteMapプラグインを導入します。
環境とバージョン
・WordPress: 2.7.1
・Google XML Sitemaps: 3.1.2
WP-Syntaxプラグインの導 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://has.s321.xrea.com/wp-content/uploads/2009/12/line_01.gif" alt="line" title="line" width="450" height="1" class="aligncenter size-full wp-image-383" /></p>
<p>SEO対策として、検索エンジン向けのSiteMapプラグインを導入します。</p>
<p><strong>環境とバージョン</strong><br />
・WordPress: 2.7.1<br />
・Google XML Sitemaps: 3.1.2</p>
<p><span id="more-197"></span><strong>WP-Syntaxプラグインの導入</strong><br />
・管理メニューの左メニューより「プラグイン」→「新規追加」をクリックする。<br />
・「プラグインのインストール」画面で「sitemap」キーワードにて検索する。<br />
・一覧の中から「Google XML Sitemaps」の右側の「インストール」をクリックする。<br />
・インストールが終わったらプラグインを有効化する。</p>
<p><strong>セットアップ</strong><br />
・管理画面の左メニューより「設定」をクリックする。<br />
・下の方の「XML-Sitemap」をクリックする。<br />
・ドキュメントルートへ以下２つのファイルを作成する。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">sitemap.xml
sitemap.xml.gz</pre></td></tr></table></div>

<p>・↑のパーミッションを書き込めるようにする。<br />
・「Status」内の「rebuild the sitemap」をクリックしてビルドしておく。<br />
・「Sitemap Content」内の「Include tag pages」もクリックしておきましょうか。<br />
・「Update options」をクリックして設定を有効化します。<br />
・再度「rebuild the sitemap」をクリックしておきます。<br />
・「Status」内の「sitemap」で確認できます。</p>
<p><strong>robots.txtの設定</strong><br />
・以下のようにドキュメントルートへ「robots.txt」を設置します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="language" style="font-family:monospace;">User-Agent: *
Allow: /
Sitemap: http://yourdomain.com/sitemap.xml</pre></td></tr></table></div>

<p>これで、定期的にsitemap.xmlが作成されるようになりました。<br />
<a href="http://www.google.co.jp/webmasters/" target="_blank">Googleウェブマスターツール</a>にも登録しておきましょう！</p>
<p>それでわ、(^_^)/~</p>
]]></content:encoded>
			<wfw:commentRss>http://has.s321.xrea.com/memo/wordpress/197/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
