<?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>Dabits &#187; TiPS!</title>
	<atom:link href="http://www.dabits.net/archives/category/tips/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dabits.net</link>
	<description>-環境構築屋-</description>
	<lastBuildDate>Mon, 05 Dec 2011 20:08:31 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP+cURLでFTP接続し、CWDすると失敗することがある</title>
		<link>http://www.dabits.net/archives/157</link>
		<comments>http://www.dabits.net/archives/157#comments</comments>
		<pubDate>Sun, 03 Apr 2011 00:16:32 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[TiPS!]]></category>

		<guid isPermaLink="false">http://www.dabits.net/?p=157</guid>
		<description><![CDATA[諸所の理由でPHP+cURLでFTPダウンロードしてたのですが、 サーバ環境によってはCWDがうまいこといかないみたい；； なぜか。 詳細ログをとってFTPコマンドのやり取りを解析してみた。 実行したソースコード PLA &#8230; <a href="http://www.dabits.net/archives/157">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>諸所の理由でPHP+cURLでFTPダウンロードしてたのですが、<br />
サーバ環境によってはCWDがうまいこといかないみたい；；</p>
<p>なぜか。</p>
<p>詳細ログをとってFTPコマンドのやり取りを解析してみた。</p>
<p>実行したソースコード</p>
<div class="igBar"><span id="lphp-3"><a href="#" onclick="javascript:showPlainTxt('php-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-3">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//ftp接続設定</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$baseUrl</span> = <span style="color:#FF0000;">&#8220;ftp://hoge:foobar@127.0.0.1/&#8221;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$path</span> = <span style="color:#FF0000;">&#8220;/var/www/html/index.html&#8221;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//テンポラリファイル準備</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$fp</span> = <a href="http://www.php.net/tmpfile"><span style="color:#000066;">tmpfile</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$fpe</span> = <a href="http://www.php.net/tmpfile"><span style="color:#000066;">tmpfile</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//curlに設定をセット</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$options</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_QUOTE =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8220;CWD &#8220;</span> . <a href="http://www.php.net/dirname"><span style="color:#000066;">dirname</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_URL =&gt; <span style="color:#0000FF;">$baseUrl</span> . <a href="http://www.php.net/basename"><span style="color:#000066;">basename</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_FILE =&gt; <span style="color:#0000FF;">$fp</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_VERBOSE =&gt; <span style="color:#000000; font-weight:bold;">true</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_STDERR =&gt; <span style="color:#0000FF;">$fpe</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//curl実行</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$ch</span> = curl_init<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">curl_setopt_array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ch</span>, <span style="color:#0000FF;">$options</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">curl_exec<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ch</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">curl_close<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$ch</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/fclose"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fp</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//ログ表示</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/rewind"><span style="color:#000066;">rewind</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fpe</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> stream_get_contents<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fpe</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>成功するパターン</p>
<p>1度目の接続</p>
<pre>* About to connect() to 127.0.0.1 port 21 (#0)
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
&lt; 220 ProFTPD 1.3.3 Server (ProFTPD) [127.0.0.1] &gt; USER hoge
&lt; 331 Password required for foo. &gt; PASS foobar
&lt; 230 User foo logged in. &gt; PWD
&lt; 257 "/home/hoge" is current directory. * Entry path is '/home/hoge' &gt; CWD /var/www/html
&lt; 250 CWD command successful
...</pre>
<p>2度目の接続</p>
<pre>* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
* Request has same path as previous transfer
&gt; CWD /var/www/html
&lt; 250 CWD command successful
...</pre>
<p>失敗するパターン</p>
<p>1度目の接続</p>
<pre>* About to connect() to 127.0.0.1 port 21
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 21
&lt; 220 ProFTPD 1.3.3 Server (ProFTPD) [127.0.0.1] &gt; USER hoge
&lt; 331 Password required for foo. &gt; PASS foobar
&lt; 230 User foo logged in. &gt; PWD
&lt; 257 "/home/hoge" is current directory. * Entry path is '/home/hoge' &gt; CWD /var/www/html
&lt; 250 CWD command successful
...</pre>
<p>2度目の接続</p>
<pre>* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 21
&gt; CWD /var/www/html
&lt; 250 CWD command successful &gt; CWD /home/hoge
&lt; 250 CWD command successful
...</pre>
<p>ログ見て、一目瞭然っすね。<br />
CURLOPT_QUOTEでせっかくCWDしたのに、こいつ、ホームディレクトリに再度CWDしてやがる・・・・！！<br />
どおりでダウンロードできないわけね。</p>
<p>解決策探したけれど、中々解決できなかったので妥協して下記のようにした。</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$options</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_QUOTE =&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8220;CWD &#8220;</span> . <a href="http://www.php.net/dirname"><span style="color:#000066;">dirname</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_URL =&gt; <span style="color:#0000FF;">$baseUrl</span> . <a href="http://www.php.net/basename"><span style="color:#000066;">basename</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_FILE =&gt; <span style="color:#0000FF;">$fp</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CURLOPT_FRESH_CONNECT =&gt; <span style="color:#000000; font-weight:bold;">true</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>CURLOPT_FRESH_CONNECTをtrueにすると、接続を保持せず再接続するみたい。<br />
新規接続時はCWDが正常に動くので、とりあえずこれで。</p>
<p>とはいえ何度もログインしてて非常に美しくないので、もし解決策知ってる方がいたら教えてください！＞＜</p>
<p>参考<br />
<a href="http://webmagic.winofsql.jp/sh_web100519070930.htm">PHP + cURL : さくらインターネットの FTPES でダウンロード</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>手動でACPIマルチプロセッサのHALをいれなおす</title>
		<link>http://www.dabits.net/archives/148</link>
		<comments>http://www.dabits.net/archives/148#comments</comments>
		<pubDate>Sun, 04 Jul 2010 17:02:21 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.dabits.net/?p=148</guid>
		<description><![CDATA[ネットブックのデュアルブート化の際、誤ってHALを削除してしまうという大失態を犯し、 以降通常のhal.dllでしか起動しなくなってしまいました。 Atomはマルチプロセッサとして動作するので、そのようにHALを入れなお &#8230; <a href="http://www.dabits.net/archives/148">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ネットブックのデュアルブート化の際、誤ってHALを削除してしまうという大失態を犯し、<br />
以降通常のhal.dllでしか起動しなくなってしまいました。<br />
Atomはマルチプロセッサとして動作するので、そのようにHALを入れなおす必要があります。<br />
今回はその修復メモ。<br />
<span id="more-148"></span></p>
<h2>##前提環境</h2>
<p>WindowsXP Home Edition SP3<br />
ディスクブートなOS(Knoppixなど)</p>
<h2>##修復方法</h2>
<p>・使用されていたHALを探す<br />
まずセットアップのログを見て、どのようなHALがインストールされていたのかアタリをつけます。<br />
C:\WINDOWS\repair\setup.log をhal.dllで検索すると、下記のようにヒットするはずです。</p>
<pre>\WINDOWS\system32\hal.dll = "halmacpi.dll","2812c"
\WINDOWS\system32\ntkrnlpa.exe = "ntkrpamp.exe","1f1bd2"
\WINDOWS\system32\ntoskrnl.exe = "ntkrnlmp.exe","217c37"</pre>
<p>私の環境では、halmacpi.dllが使われている模様でした。<br />
続いて、ntkrnlpa.exeやntoskrnl.exeの欄も見ておきます。<br />
マルチプロセッサだとこのファイルが変わるためです。これらのファイル名をメモっておきます。</p>
<p>・サービスパックのパッケージからファイルを抽出する<br />
上記でメモしたファイルを、サービスパックのパッケージから抽出します。<br />
SP3を改めて導入してしまった場合、下記のファイルにhalが入っている模様です。<br />
C:\WINDOWS\Driver Cache\i386\sp3.cab<br />
このファイルを展開し、メモしたファイルたちを探し出して適当なフォルダに入れておきます。<br />
ファイル名はsetup.logに書かれていたように変更しておきます。<br />
たとえば、halmacpi.dllならhal.dllのようにしておきます。</p>
<p>・システムファイルを置換する<br />
マシンを再起動し、ディスクブートなOSで適当に起動します。<br />
あとはhal.dllたちを入れ替えるだけです。C:\Windows\system32の中に入っているので、<br />
hal.dll、ntkrnlpa.exe、ntoskrnl.exeのバックアップをとり、ファイルを置換します。</p>
<p>&#8212;<br />
こんな感じで修復できました！よかった！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/148/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redmineのアカウントを使って、Subversionの認証を行う on debian lenny</title>
		<link>http://www.dabits.net/archives/87</link>
		<comments>http://www.dabits.net/archives/87#comments</comments>
		<pubDate>Tue, 30 Mar 2010 02:15:57 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[Apache関連]]></category>

		<guid isPermaLink="false">http://www.dabits.net/?p=87</guid>
		<description><![CDATA[むちゃくちゃつまづきどころが多かったのでメモ。 mod_auth_mysqlのインストール 普通にコマンド入力してインストールします www@admin:~$ sudo apt-get install libapache &#8230; <a href="http://www.dabits.net/archives/87">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>むちゃくちゃつまづきどころが多かったのでメモ。</p>
<p>mod_auth_mysqlのインストール</p>
<p>普通にコマンド入力してインストールします</p>
<pre>www@admin:~$ sudo apt-get install libapache2-mod-auth-mysql</pre>
<p>問題が、mod_auth_mysql.so が mod_auth_basic.so より先に読み込めないと、以下のエラーが出ちゃいます。</p>
<pre>pcfg_openfile() called with NULL filename</pre>
<p>ということで名前を変えて先に起動するようにセット</p>
<pre>www@admin:~$ sudo cp /etc/apache2/mods-available/auth_mysql.load /etc/apache2/mods-available/auth_00mysql.load</pre>
<p>各種モジュール有効化</p>
<pre>www@admin:~$ sudo a2enmod auth_00mysql auth_basic auth_digest</pre>
<p>で、設定したいsvnのconfに以下のように記述</p>
<pre>
&lt;Location "/svn"&gt;
DAV svn
SVNParentPath /var/www/svn
     &lt;LimitExcept GET PROPFIND OPTIONS REPORT&gt;
       Auth_MySQL                      On
       Auth_MySQL_Socket               /var/run/mysqld/mysqld.sock
       Auth_MySQL_Host                 localhost
       Auth_MySQL_User                 [redmineのデータベースユーザ名]
       Auth_MySQL_Password             [redmineのデータベースパスワード]
       Auth_MySQL_DB                   [redmineのデータベース名]
       Auth_MySQL_Password_Table       users
       Auth_MySQL_Username_Field       login
       Auth_MySQL_Password_Field       hashed_password
       Auth_MySQL_Encryption_Types     SHA1Sum
       Auth_MySQL_Empty_Passwords      Off
       AuthType Basic
       AuthName "Authorization Realm"
       Require valid-user
     &lt;/LimitExcept&gt;
&lt;/Location&gt;
</pre>
<p>AuthMySQLのパラメータ名が違うのと、Encryption_TypesがSHA1Sumなのがコツ。<br />
なんでsha1じゃねーんだ。。ヽ(`Д´)ﾉウワーン</p>
<p>パラメータ違うと、</p>
<pre>Invalid command 'AuthMySQLEnable', perhaps misspelled or defined by a module not included in the server configuration</pre>
<p>って出るし、SHA1Sumじゃないと</p>
<pre>Unsupported encryption type: sha1</pre>
<p>って出る。分かるかい！ヽ(`Д´)ﾉウワーン</p>
<p>ということで、</p>
<pre>www@admin:~$ sudo /etc/init.d/apache2 reload</pre>
<p>して無事にsvnが動くのでした。。疲れた。。</p>
<p>参考サイト：<br />
<a href="http://d.hatena.ne.jp/ksaito11/20090924">Subversion+Apache からredmineの認証を使う</a><br />
<a href="http://www.nognog.com/techmemo/Apache2_MySQL_Auth_HOWTO.php">うにっくすさんの覚え書き &#8211; Apache2 &#8211; MySQL認証</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/87/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>cakephp1.2流のエレメントキャッシュ</title>
		<link>http://www.dabits.net/archives/12</link>
		<comments>http://www.dabits.net/archives/12#comments</comments>
		<pubDate>Sat, 02 May 2009 11:33:22 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/?p=11</guid>
		<description><![CDATA[サイドメニューなど、エレメントの部分だけキャッシュしたかったので、 マニュアルの3.9.3.2 エレメントをキャッシュするを見て、実装したのですが、 コントローラ側からCache::read();としても反応なし。 ・・ &#8230; <a href="http://www.dabits.net/archives/12">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>サイドメニューなど、エレメントの部分だけキャッシュしたかったので、<br />
マニュアルの<a href="http://book.cakephp.org/ja/view/561/Caching-Elements">3.9.3.2 エレメントをキャッシュする</a>を見て、実装したのですが、<br />
コントローラ側からCache::read();としても反応なし。<br />
・・・？と思いながらview.phpを眺めていると、以下の記述が。。。</p>

<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showPlainTxt('php-9'); return false;"><span class="caps">PLAIN TEXT</span></a></span></div><div class="syntax_hilite"><span class="langName"><span class="caps">PHP</span>:</span><br /><div id="php-9">
<div class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$expires</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$cacheFile</span> = <span style="color:#FF0000;">&#8216;element_&#8217;</span> . <span style="color:#0000FF;">$key</span> . <span style="color:#FF0000;">&#8216;_&#8217;</span> . <span style="color:#0000FF;">$plugin</span> . Inflector::<span style="color:#006600;">slug</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$name</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$cache</span> = cache<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;views&#8217;</span> . DS . <span style="color:#0000FF;">$cacheFile</span>, <span style="color:#000000; font-weight:bold;">null</span>, <span style="color:#0000FF;">$expires</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/is_string"><span style="color:#000066;">is_string</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$cache</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#0000FF;">$cache</span>;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div></li></ol></div>
</div></div><br />

<p>あれ、cache();って1.1のやつだから非推奨のはずじゃぁ。。。<br />
ってことで、cakephp1.2流のelementキャッシュを考えてみた。</p>

●view側<br />
<div class="igBar"><span id="lphp-10"><a href="#" onclick="javascript:showPlainTxt('php-10'); return false;"><span class="caps">PLAIN TEXT</span></a></span></div><div class="syntax_hilite"><span class="langName"><span class="caps">PHP</span>:</span><br /><div id="php-10">
<div class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$this</span>-&gt;;element<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;left_menu&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span>; </div></li></ol></div>
</div></div><br />
の代わりに以下を挿入<br />
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;"><span class="caps">PLAIN TEXT</span></a></span></div><div class="syntax_hilite"><span class="langName"><span class="caps">PHP</span>:</span><br /><div id="php-11">
<div class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$element</span> = Cache::<span style="color:#006600;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;left_menu&#8217;</span>, <span style="color:#FF0000;">&#8216;element&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> === <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$element</span> = <span style="color:#0000FF;">$this</span>-&gt;element<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;left_menu&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; Cache::<span style="color:#006600;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;left_menu&#8217;</span>, <span style="color:#0000FF;">$element</span>, <span style="color:#FF0000;">&#8216;element&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$element</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div></li></ol></div>
</div></div><br />

●コントローラ側<br />
beforeFilterなどでエレメントキャッシュを定義し、<br />
キャッシュが存在しない場合に限り、クエリを発行する。<br />
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;"><span class="caps">PLAIN TEXT</span></a></span></div><div class="syntax_hilite"><span class="langName"><span class="caps">PHP</span>:</span><br /><div id="php-12">
<div class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$config</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">&#8216;engine&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;File&#8217;</span>,</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">&#8216;duration&#8217;</span>=&gt; <span style="color:#FF0000;">&#8216;+5 min&#8217;</span>,</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">&#8216;path&#8217;</span> =&gt; <span class="caps">CACHE</span> . <span style="color:#FF0000;">&#8216;views&#8217;</span> . <span class="caps">DS,</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF0000;">&#8216;prefix&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;element_&#8217;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Cache::<span style="color:#006600;">config</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;element&#8217;</span>, <span style="color:#0000FF;">$config</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&lt;/code&gt;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> Cache::<span style="color:#006600;">read</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;left_menu&#8217;</span>, <span style="color:#FF0000;">&#8216;element&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span> === <span style="color:#000000; font-weight:bold;">false</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$areas</span> = <span style="color:#0000FF;">$this</span><del>&gt;Area</del>&gt;find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;menu&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$categories</span> = <span style="color:#0000FF;">$this</span><del>&gt;Category</del>&gt;find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;menu&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;set<span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/compact"><span style="color:#000066;">compact</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">&#8216;areas&#8217;</span>, <span style="color:#FF0000;">&#8216;categories&#8217;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div></li></ol></div>
</div></div><br />

<p>これで劇早&amp;1.2流のキャッシュができましたー！</p>]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/12/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOSでmod_rails(Passenger)のインストール</title>
		<link>http://www.dabits.net/archives/11</link>
		<comments>http://www.dabits.net/archives/11#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:49:40 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[Apache関連]]></category>
		<category><![CDATA[サーバ構築]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/archives/10</guid>
		<description><![CDATA[仕事先でmod_railsを使う機会があったのでインストールしてみました。 mod_railsは何かというと、ruby on railsをapacheのモジュールとして起動する事により 効率を大幅に上げよう、というもので &#8230; <a href="http://www.dabits.net/archives/11">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[仕事先でmod_railsを使う機会があったのでインストールしてみました。<br />
mod_railsは何かというと、ruby on railsをapacheのモジュールとして起動する事により<br />
効率を大幅に上げよう、というものです。<br />
また、特定数秒(デフォでは120秒)アクセスがないと、自動的にプロセスが終了したり、<br />
アクセスが多いと増加するので、単純にmongrelをたくさん起動しておくよりも効率的です。<br />
以前はApache+mongrel_railsでしたが、明らかにレスポンスが向上しました。<br />
では早速インストールの記録を。<br />
<span id="more-11"></span><br />
<b>1.passengerのインストール</b><br />
gemを使ってpassengerをインストールします。<br />
なんか下にwarning出たけど問題ありませんでした。<br />
<blockquote>[root@rails-dev ~]# <font color="green">gem install passenger</font>
Building native extensions.  This could take a while&#8230;<br />
Successfully installed rack-0.9.1<br />
Successfully installed passenger-2.0.6<br />
2 gems installed<br />
Installing ri documentation for rack-0.9.1&#8230;<br />
Installing ri documentation for passenger-2.0.6&#8230;<br />
Installing RDoc documentation for rack-0.9.1&#8230;<br />
Installing RDoc documentation for passenger-2.0.6&#8230;<br />
./doc/template/horo.rb:17: warning: already initialized constant <span class="caps">FONTS</span><br />
./doc/template/horo.rb:19: warning: already initialized constant <span class="caps">STYLE</span><br />
./doc/template/horo.rb:213: warning: already initialized constant <span class="caps">XHTML</span>_PREAMBLE<br />
./doc/template/horo.rb:221: warning: already initialized constant <span class="caps">HEADER</span><br />
./doc/template/horo.rb:272: warning: already initialized constant <span class="caps">FILE</span>_PAGE<br />
./doc/template/horo.rb:300: warning: already initialized constant <span class="caps">CLASS</span>_PAGE<br />
./doc/template/horo.rb:338: warning: already initialized constant <span class="caps">METHOD</span>_LIST<br />
./doc/template/horo.rb:486: warning: already initialized constant <span class="caps">FOOTER</span><br />
./doc/template/horo.rb:491: warning: already initialized constant <span class="caps">BODY</span><br />
./doc/template/horo.rb:503: warning: already initialized constant <span class="caps">SRC</span>_PAGE<br />
./doc/template/horo.rb:531: warning: already initialized constant FR_INDEX_BODY<br />
./doc/template/horo.rb:535: warning: already initialized constant <span class="caps">FILE</span>_INDEX<br />
./doc/template/horo.rb:583: warning: already initialized constant <span class="caps">CLASS</span>_INDEX<br />
./doc/template/horo.rb:584: warning: already initialized constant <span class="caps">METHOD</span>_INDEX<br />
./doc/template/horo.rb:586: warning: already initialized constant <span class="caps">INDEX</span></blockquote>
<b>2.http-develのインストール</b><br />
mod_railsを生成するにはapacheモジュールとしてのコンパイルが必要です。<br />
事前にyumで開発キットをインストールしておきます。<br />
(その前にgcc,gppなどをあらかじめインストールしておいてください。)<br />
<blockquote>[root@rails-dev ~]# <font color="green">yum -y install httpd-devel</font>
base                      100% |=========================| 1.1 kB    00:00<br />
updates                   100% |=========================|  951 B    00:00<br />
primary.xml.gz            100% |=========================| 369 kB    00:00<br />
updates   : ################################################## 796/796<br />
addons                    100% |=========================|  951 B    00:00<br />
extras                    100% |=========================| 1.1 kB    00:00<br />
Setting up Install Process<br />
・<br />
・<br />
・<br />
Installed: httpd-devel.i386 0:2.2.3-11.el5_2.centos.4<br />
Dependency Installed: apr-devel.i386 0:1.2.7-11 apr-util-devel.i386 0:1.2.7-7.el<br />
5<br />
Updated: httpd.i386 0:2.2.3-11.el5_2.centos.4<br />
Dependency Updated: httpd-manual.i386 0:2.2.3-11.el5_2.centos.4 mod_ssl.i386 1:2<br />
.2.3-11.el5_2.centos.4<br />
Complete!</blockquote>
<b>3.passengerの設定</b><br />
passengerを設定し、モジュールを作成します。<br />
<blockquote>[root@rails-dev insoshi]# <font color="green">passenger-install-apache2-module</font>
Welcome to the Phusion Passenger Apache 2 module installer, v2.0.6.<br />
This installer will guide you through the entire installation process. It<br />
shouldn&#8217;t take more than 3 minutes in total.<br />
Here&#8217;s what you can expect from the installation process:<br />
1. The Apache 2 module will be installed for you.<br />
2. You&#8217;ll learn how to configure Apache.<br />
3. You&#8217;ll learn how to deploy a Ruby on Rails application.<br />
Don&#8217;t worry if anything goes wrong. This installer will advise you on how to<br />
solve any problems.<br />
Press Enter to continue, or Ctrl-C to abort.<br />
<font color="green">1</font><br />
Checking for required software&#8230;<br />
* <span class="caps">GNU</span> C++ compiler&#8230; found at /usr/bin/g++<br />
* Ruby development headers&#8230; found<br />
* OpenSSL support for Ruby&#8230; found<br />
* RubyGems&#8230; found<br />
* Rake&#8230; found at /usr/bin/rake<br />
* Apache 2&#8230; found at /usr/sbin/httpd<br />
* Apache 2 development headers&#8230; found at /usr/sbin/apxs<br />
* Apache Portable Runtime (APR) development headers&#8230; found at /usr/bin/apr-1-<br />
config<br />
* Apache Portable Runtime Utility (APR) development headers&#8230; found at /usr/bi<br />
n/apu-1-config<br />
* fastthread&#8230; found<br />
* rack&#8230; found<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Compiling and installing Apache 2 module&#8230;<br />
cd /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6<br />
/usr/bin/ruby -S rake clean apache2<br />
(in /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6)<br />
・・・コンパイルが始まる・・・<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
The Apache 2 module was successfully installed.<br />
Please edit your Apache configuration file, and add these lines:<br />
<font color="blue">   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so<br />
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6<br />
PassengerRuby /usr/bin/ruby</font><br />
<font color="green">↑以上がapacheの設定に書き込む部分になるので、コピーしておきます。</font><br />
After you restart Apache, you are ready to deploy any number of Ruby on Rails<br />
applications on Apache, without any further Ruby on Rails-specific<br />
configuration!<br />
Press <span class="caps">ENTER </span>to continue.<br />
<font color="green">エンターを押す</font><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Deploying a Ruby on Rails application: an example<br />
Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host<br />
to your Apache configuration file, and set its DocumentRoot to<br />
/somewhere/public, like this:<br />
<virtualHost *:80><br />
ServerName www.yourhost.com<br />
DocumentRoot /somewhere/public<br />
</virtualHost><br />
And that&#8217;s it! You may also want to check the Users Guide for security and<br />
optimization tips and other useful information:<br />
/usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/doc/Users guide.html<br />
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) <img src='http://www.dabits.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> 

<p>http://www.modrails.com/</p>

Phusion Passenger is a trademark of Hongli Lai &#038; Ninh Bui.</blockquote>
<b>4.apacheの設定をする</b><br />
先ほどコピーした内容を貼り付け、さらに具体的に使用するrailsアプリケーションの指定をします。<br />
今回はinsoshiというrailsアプリケーションを使いました。<br />
<blockquote>[root@rails-dev ~]# <font color="green">vi /etc/httpd/conf.d/mod_rails.conf</font>
<font color="green">   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so<br />
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6<br />
PassengerRuby /usr/bin/ruby<br />
<font color="blue">↑先ほどコピーした部分をそのまま貼り付け</font><br />
<virtualHost *:80><br />
DocumentRoot /var/shared/insoshi/public<br />
<directory /var/shared/insoshi/public><br />
Options Indexes FollowSymLinks Includes ExecCGI<br />
AllowOverride All<br />
Order allow,deny<br />
Allow from all<br />
</directory><br />
<font color="blue">↑DocumentRootにはpublicを指定</font><br />
</virtualHost></font></blockquote>
<b>5.apacheのリロード</b><br />
apacheの設定をリロードさせて、設定を適用します。<br />
<blockquote>[root@rails-dev ~]#<font color="green">service httpd reload</font></blockquote>
これで対象のサーバにアクセスすると、無事起動する事ができました。<br />
*参考サイト<br />
<a href="http://d.hatena.ne.jp/rx7/20080412/p1" target="_blank">Passenger (mod_rails for Apache) を使ってRedmineを動かしてみたよ！ &#8211; RX-7乗りの適当な日々</a><br />
<a href="http://doruby.kbmj.com/yoppi_on_rails/20080417/Passenger__mod_rails_for_apache_" target="_blank">Passenger (mod_rails for apache)での色んな設定値について調べてみた</a><br />
<a href="http://redmine.jp/tech_note/apache-passenger/" target="_blank">Apache上でRuby on Railsアプリケーションを動かす／Passenger(mod_rails for Apache)の利用</a>]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/11/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>データベースが文字化けしたら&#8230;</title>
		<link>http://www.dabits.net/archives/10</link>
		<comments>http://www.dabits.net/archives/10#comments</comments>
		<pubDate>Sun, 26 Oct 2008 11:45:22 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/archives/9</guid>
		<description><![CDATA[CakePHPで開発している際に、phpmyadminなどでデータベースの中身を表示させようとすると、 文字化けする事があります。 これは、CakePHP内のdatabase.phpに記述が足りない事が原因の模様。。。  &#8230; <a href="http://www.dabits.net/archives/10">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[CakePHPで開発している際に、phpmyadminなどでデータベースの中身を表示させようとすると、<br />
文字化けする事があります。<br />
これは、CakePHP内のdatabase.phpに記述が足りない事が原因の模様。。。<br />
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showPlainTxt('php-14'); return false;"><span class="caps">PLAIN TEXT</span></a></span></div><div class="syntax_hilite"><span class="langName"><span class="caps">PHP</span>:</span><br /><div id="php-14">
<div class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">var</span> <span style="color:#0000FF;">$default</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>&nbsp; &nbsp;<span style="color:#FF0000;">&#8216;driver&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;mysql&#8217;</span>,</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;connect&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;mysql_connect&#8217;</span>,</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;host&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;localhost&#8217;</span>,</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;login&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;root&#8217;</span>,</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;password&#8217;</span> =&gt; <span style="color:#FF0000;">&#8221;</span>,</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;database&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;encodetest&#8217;</span>,</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;encoding&#8217;</span> =&gt; <span style="color:#FF0000;">&#8216;utf8&#8242;</span>, ←この部分を追加</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">&#8216;prefix&#8217;</span> =&gt; <span style="color:#FF0000;">&#8221;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div></li></ol></div>
</div></div><br />
(前のデータは化けてしまいますが、)これで新規データ分については文字化けが起こらないようになりました。<br />
参考:<a href="http://php.sunvisor.net/2007/11/cakephp_2.html" target="_blank">続・CakePHPと文字化け (PHP学習日記)</a>]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>拡張子がmp3のファイルを強制ダウンロードさせる</title>
		<link>http://www.dabits.net/archives/9</link>
		<comments>http://www.dabits.net/archives/9#comments</comments>
		<pubDate>Tue, 21 Oct 2008 11:41:31 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[Apache関連]]></category>
		<category><![CDATA[サーバ構築]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/archives/8</guid>
		<description><![CDATA[通常、単にmp3ファイルをweb上に置いただけでは、 mimeタイプがaudio/mp3となってしまい、ブラウザによってプレーヤが起動したり、ダウンロードしたり、と挙動が異なってしまいます。 そこで、拡張子がmp3のファ &#8230; <a href="http://www.dabits.net/archives/9">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[通常、単にmp3ファイルをweb上に置いただけでは、<br />
mimeタイプがaudio/mp3となってしまい、ブラウザによってプレーヤが起動したり、ダウンロードしたり、と挙動が異なってしまいます。<br />
そこで、拡張子がmp3のファイルは、mimeタイプを変えて強制ダウンロードさせることにしました。<br />
＜方法＞<br />
対象のディレクトリに.htaccessファイルを作り、以下の内容を記入します。<br />
<div class="igBar"><span id="lcode-16"><a href="#" onclick="javascript:showPlainTxt('code-16'); return false;"><span class="caps">PLAIN TEXT</span></a></span></div><div class="syntax_hilite"><span class="langName"><span class="caps">CODE</span>:</span><br /><div id="code-16">
<div class="code"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">AddType application/octet-stream .<span style="">mp3</span> </div></li></ol></div>
</div></div><br />
※最終行の改行をお忘れなく。<br />
これで、ファイルのクリックをした場合、ダウンロード画面が表示されるようになりました。]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>右クリック一発でコマンドプロンプトを開く　の　レジストリ</title>
		<link>http://www.dabits.net/archives/8</link>
		<comments>http://www.dabits.net/archives/8#comments</comments>
		<pubDate>Wed, 06 Aug 2008 20:36:35 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/archives/7</guid>
		<description><![CDATA[開発者の方にはとっても便利な機能。 アイコンを右クリックしてコマンドプロンプトが選択できるようになります。 ●方法 以下の内容をmigi_cmd.regで保存し、実行するだけ。 PLAIN TEXT CODE: Wind &#8230; <a href="http://www.dabits.net/archives/8">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>開発者の方にはとっても便利な機能。<br />
アイコンを右クリックしてコマンドプロンプトが選択できるようになります。<br />
●方法<br />
以下の内容をmigi_cmd.regで保存し、実行するだけ。</p>
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showPlainTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Windows Registry Editor Version <span style="color:#800000;color:#800000;">5</span>.<span style="color:#800000;color:#800000;">00</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>HKEY_CLASSES_ROOT\Directory\shell\cmd<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@=<span style="color:#CC0000;">&#8220;コマンドプロンプト&#8221;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>HKEY_CLASSES_ROOT\Directory\shell\cmd\command<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@=<span style="color:#CC0000;">&#8220;cmd.exe /k <span style="color:#000099; font-weight:bold;">\&#8221;</span>cd %l<span style="color:#000099; font-weight:bold;">\&#8221;</span>&#8220;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
参考:<a href="http://trendy.nikkeibp.co.jp/article/tec/winxp/20050309/111687/" target="_blank">選んだフォルダをカレントフォルダにしてコマンドプロンプトを開く</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/8/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gemをアップデートするとうまく動作しない問題のまとめ</title>
		<link>http://www.dabits.net/archives/7</link>
		<comments>http://www.dabits.net/archives/7#comments</comments>
		<pubDate>Wed, 06 Aug 2008 04:56:58 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[サーバ構築]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/archives/6</guid>
		<description><![CDATA[gemを最新版にアップデートすると仕様変更からさまざまなエラーが発生するため、 そのままではうまく動作しません。この問題にはまり、2時間も消費した。。。 エラーと共に、状況をまとめてみます。 環境:vmware, deb &#8230; <a href="http://www.dabits.net/archives/7">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>gemを最新版にアップデートすると仕様変更からさまざまなエラーが発生するため、<br />
そのままではうまく動作しません。この問題にはまり、2時間も消費した。。。<br />
エラーと共に、状況をまとめてみます。<br />
環境:vmware, debian etch, gemなどはパッケージにてインストール<br />
１.まず、gemをアップデートする</p>
<pre>gem update --system
gem pristine --all</pre>
<p>ただし、アップデート後にgemコマンド (gem pristine &#8211;all)を実行した段階で以下のエラーが発生します。</p>
<pre>uninitialized constant Gem::GemRunner (NameError) </pre>
<p>または</p>
<pre>ERROR:  While executing gem ... (Gem::Exception)
Failed to find gem rails >= 0</pre>
<p>このエラーの対処のため、/usr/bin/gemの8行目辺り、require &#8216;rubygems&#8217;の下に以下を追加します。</p>
<pre>require 'rubygems/gem_runner'</pre>
<p>再度gem pristine &#8211;allを試してみる。</p>
<pre>testsrv01:~# gem pristine --all
Restoring gem(s) to pristine condition...
Restored rails-2.1.0
Restored activeresource-2.1.0
Restored actionpack-2.1.0
Restored actionmailer-2.1.0
Restored activerecord-2.1.0
Restored rake-0.8.1</pre>
<p>これで一応動作するようになります。<br />
&#8212;参考サイト<br />
<a href="http://d.hatena.ne.jp/kusakari/20080107/1199688126" target="_blank">undefined method `require_gem&#39; for main:Object &#8211; 夜の Discovery</a><br />
<a href="http://railspress.matake.jp/press-0027-warning-require_gem-is-obsolete%E3%82%92%E8%A7%A3%E6%B1%BA-rails201%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%A2%E3%83%83%E3%83%97%E6%A0%BC%E9%97%98%E8%A8%98" target="_blank">“Warning: require_gem is obsolete.”を解決 &#8211; Rails2.0.1バージョンアップ格闘記</a><br />
<a href="http://ymb.no-blog.jp/blues/2007/11/apacheruby_on_r_b300.html" target="_blank">Kazu-の気ままにOSS: ApacheとRuby on Railsの連携</a><br />
<a href="http://d.hatena.ne.jp/ywatase/20080512" target="_blank">railsにやられ気味 &#8211; ニッキ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/7/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>学校・企業でフィルタ突破！</title>
		<link>http://www.dabits.net/archives/6</link>
		<comments>http://www.dabits.net/archives/6#comments</comments>
		<pubDate>Wed, 09 Jul 2008 16:12:11 +0000</pubDate>
		<dc:creator>dabits</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[ネットワーク関連]]></category>

		<guid isPermaLink="false">http://tips.dabits.net/archives/5</guid>
		<description><![CDATA[最近どこの学校、企業でもそうですが、エッチぃサイト見れないようにフィルタリングされてたり、 余計なポートが塞いであって、VNCつなげなかったり、掲示板見れなかったりします。 そんなこんなで見つけてきた対応策をメモしときま &#8230; <a href="http://www.dabits.net/archives/6">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>最近どこの学校、企業でもそうですが、エッチぃサイト見れないようにフィルタリングされてたり、<br />
余計なポートが塞いであって、VNCつなげなかったり、掲示板見れなかったりします。<br />
そんなこんなで見つけてきた対応策をメモしときます。<br />
>>方法１ &#8211; webproxyを使う<br />
はい、一番手っ取り早いですねｗ<br />
「webproxy cgiproxy phpproxy」のいずれかでググればこの手のサイトは山ほど手に入ります。<br />
ここではたくさんリストがされているサイトを紹介しときます。<br />
<a href="http://magic3.net/text/web_proxy.html" target="_blank">ウェブプロキシ(WebProxy)の概要と設置サイト</a><br />
<a href="http://www.google.co.jp/search?ie=Shift_JIS&amp;#038;oe=Shift_JIS&amp;#038;hl=ja&amp;#038;q=cgiproxy" target="_blank">cgiproxy &#8211; Google検索</a><br />
<a href="http://www.google.co.jp/search?ie=Shift_JIS&amp;#038;oe=Shift_JIS&amp;#038;hl=ja&amp;#038;q=webproxy" target="_blank">webproxy &#8211; Google検索</a><br />
<a href="http://www.google.co.jp/search?ie=Shift_JIS&amp;#038;oe=Shift_JIS&amp;#038;hl=ja&amp;#038;q=phpproxy" target="_blank">phpproxy &#8211; Google検索</a><br />
>>方法2 &#8211; httpトンネルを使う<br />
たとえば、フィルタリングされてて、それがproxy経由である場合、httpトンネルが使える場合があります。<br />
目的のサイトへSSLで暗号化してつなげるから、フィルタリングをスルー、っていうもの。<br />
一番簡単なのが「<a href="http://www.htthost.com/" target="_blank"><span class="caps">HTTP</span>ort</a>」というソフト。<br />
これを起動して、適当に設定して、proxyの設定をlocalhostに向けるだけで、フィルタリングをスルーできてしまいます。<br />
以下のページに、日本語の分かりやすい解説ページがあります。<br />
<a href="http://himagine.s20.xrea.com/httport/httport.htm" target="_blank"><span class="caps">HTTP</span>ortでファイアーウォール（プロキシ）を超えよう</a><br />
<a href="http://tshr0531.hp.infoseek.co.jp/httport.html" target="_blank"><span class="caps">HTTP</span>ort</a><br />
>>方法3 &#8211; <span class="caps">SSH</span>トンネルを使う<br />
<span class="caps">VPN</span>やらリモートデスクトップを使いたい際には、この手段が一番です。<br />
まず、SSHで接続できるサーバを確保します。自宅サーバでもOKです。<br />
次に、PUTTYやらTeraTermで接続ポートを設定すれば、完了です。<br />
*詳細は後日書きます。<br />
まぁ、こんなところで。</p>]]></content:encoded>
			<wfw:commentRss>http://www.dabits.net/archives/6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
