<?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>仙人の心得 &#187; php</title>
	<atom:link href="http://blog.mktime.com/archive/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mktime.com</link>
	<description>修行の日々を淡々と</description>
	<lastBuildDate>Thu, 05 May 2011 07:39:25 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>CentOS：日本語入力できるようにする</title>
		<link>http://blog.mktime.com/archive/108.html</link>
		<comments>http://blog.mktime.com/archive/108.html#comments</comments>
		<pubDate>Sat, 18 Apr 2009 08:53:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[centOS]]></category>
		<category><![CDATA[SCIM]]></category>
		<category><![CDATA[日本語]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=108</guid>
		<description><![CDATA[yumのリポジトリを作成し、キーを登録する。 cd /etc/yum.repos.d wget http://centos.karan.org/kbsingh-CentOS-Extras.repo wget http://centos.karan.org/kbsingh-CentOS-Misc.repo rpm &#8211;import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt yumでSCIM と Anthyをインストール yum install anthy scim scim-anthy システム設定入力メソッドを Anthy + SCIM へ切替える。 /usr/sbin/alternatives &#8211;config xinput-ja_JP ここでサーバを再起動。 reboot ※今使っているVMwareイメージではブート状況の表示で日本語が四角くつぶれる。 ブートが進むと日本語表示されるようになるので気にしないことにする。 再起動してログインするとCtrl-Space（または半角/全角キー）でローマ字入力できるようになる。 ※できない場合は入力メソッドでシステム設定に従う[SCIM]が選択されているか確認する。 システム＞設定＞他の個人設定＞入力メソッド]]></description>
			<content:encoded><![CDATA[<p>yumのリポジトリを作成し、キーを登録する。</p>
<div class="console">
cd /etc/yum.repos.d<br />
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo<br />
wget http://centos.karan.org/kbsingh-CentOS-Misc.repo<br />
rpm &#8211;import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
</div>
<p>yumでSCIM と Anthyをインストール</p>
<div class="console">
yum install anthy scim scim-anthy
</div>
<p>システム設定入力メソッドを Anthy + SCIM へ切替える。</p>
<div class="console">
/usr/sbin/alternatives &#8211;config xinput-ja_JP
</div>
<p>ここでサーバを再起動。</p>
<div class="console">
reboot
</div>
<p>※今使っているVMwareイメージではブート状況の表示で日本語が四角くつぶれる。<br />
ブートが進むと日本語表示されるようになるので気にしないことにする。</p>
<p>再起動してログインするとCtrl-Space（または半角/全角キー）でローマ字入力できるようになる。</p>
<p>※できない場合は入力メソッドでシステム設定に従う[SCIM]が選択されているか確認する。
<pre>
システム＞設定＞他の個人設定＞入力メソッド
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/108.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php：Postfixで自動返信メール</title>
		<link>http://blog.mktime.com/archive/76.html</link>
		<comments>http://blog.mktime.com/archive/76.html#comments</comments>
		<pubDate>Sun, 12 Apr 2009 12:14:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=76</guid>
		<description><![CDATA[メールを受信するサーバにメール受信用ユーザを登録する。 受信するメールアドレスは[ユーザ名]@ホスト名になります。 # adduser [ユーザ名] # passwd [パスワード] .forwardに転送設定を記述 /home/[ユーザ名]/.forward register,&#8221;&#124; /usr/bin/php /path/to/autoreply.php .転送先はphpスクリプト。パイプでメール内容を渡している。 autoreply.php（返信処理の内容）はこんなふうになる。 [sourcecode language='php'] require_once(&#8220;Mail/mimeDecode.php&#8221;); //REARモジュール //メールソースを標準入力から読み込み $source = file_get_contents(&#8220;php://stdin&#8221;); if(!$source) { return false; // 読み込み失敗 } //メール解析 $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $decoder = new Mail_mimeDecode($source); $structure = $decoder->decode($params); // 送信者のメールアドレスを取得する $from_address = mb_convert_encoding(mb_decode_mimeheader($structure->headers['from']) ,mb_internal_encoding(), &#8220;auto&#8221;); [/sourcecode] [...]]]></description>
			<content:encoded><![CDATA[<p>メールを受信するサーバにメール受信用ユーザを登録する。</p>
<p>受信するメールアドレスは[ユーザ名]@ホスト名になります。</p>
<div class="console">
# adduser [ユーザ名]<br />
# passwd [パスワード]
</div>
<p>.forwardに転送設定を記述</p>
<div class="caption">/home/[ユーザ名]/.forward</div>
<div class="file">
register,&#8221;| /usr/bin/php /path/to/autoreply.php
</div>
<p>.転送先はphpスクリプト。パイプでメール内容を渡している。</p>
<p>autoreply.php（返信処理の内容）はこんなふうになる。<br />
[sourcecode language='php']<br />
require_once(&#8220;Mail/mimeDecode.php&#8221;); //REARモジュール<br />
//メールソースを標準入力から読み込み<br />
$source = file_get_contents(&#8220;php://stdin&#8221;);<br />
if(!$source) {<br />
    return false;    // 読み込み失敗<br />
}</p>
<p>//メール解析<br />
$params['include_bodies'] = true;<br />
$params['decode_bodies'] = true;<br />
$params['decode_headers'] = true;<br />
$decoder = new Mail_mimeDecode($source);<br />
$structure = $decoder->decode($params);</p>
<p>// 送信者のメールアドレスを取得する<br />
$from_address = mb_convert_encoding(mb_decode_mimeheader($structure->headers['from'])<br />
                         ,mb_internal_encoding(), &#8220;auto&#8221;);<br />
[/sourcecode]<br />
このスクリプトを標準入力無しで起動すると</p>
<p>$source = file_get_contents(&#8220;php://stdin&#8221;);</p>
<p>のところで入力待ちになって処理が中断しますが、ヘッダさえもnullなメールを送ることは出来ないので多分気にしなくてもいいはず。 </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/76.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS：memcachedをインストール</title>
		<link>http://blog.mktime.com/archive/55.html</link>
		<comments>http://blog.mktime.com/archive/55.html#comments</comments>
		<pubDate>Thu, 21 Aug 2008 11:49:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[centOS]]></category>
		<category><![CDATA[memcached]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=55</guid>
		<description><![CDATA[CentOs5.2のリポジトリにmemcachedは無いのでリポジトリを追加する。 cd /usr/local/src wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm mencachedを入れるのに必要なモジュールをインストールする。 たぶんこのあたりを入れておけばおっけーなはず。 yum install gcc yum install memcached yum install zlib-devel yum install php-pecl-memcache memcachedの設定は/etc/sysconfig/memcachedを編集する。 動かすだけならデフォルトのままでOK。 memcacheの起動 /etc/init.d/memcached start サービスを自動起動にしておく。 chkconfig memcached on テストスクリプト [sourcecode language='php'] [/sourcecode]]]></description>
			<content:encoded><![CDATA[<p>CentOs5.2のリポジトリにmemcachedは無いのでリポジトリを追加する。</p>
<pre class="console">
cd /usr/local/src
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm
</pre>
<p>mencachedを入れるのに必要なモジュールをインストールする。<br />
たぶんこのあたりを入れておけばおっけーなはず。</p>
<pre class="console">
yum install gcc
yum install memcached
yum install zlib-devel
yum install php-pecl-memcache
</pre>
<p>memcachedの設定は/etc/sysconfig/memcachedを編集する。<br />
動かすだけならデフォルトのままでOK。<br />
memcacheの起動</p>
<pre class="console">
/etc/init.d/memcached start
</pre>
<p>サービスを自動起動にしておく。</p>
<pre class="console">
chkconfig memcached on
</pre>
<p>テストスクリプト<br />
[sourcecode language='php']<br />
<?php<br />
    $cache = new Memcache;<br />
    $key = 'cache_test';<br />
    $cache->connect(&#8216;localhost&#8217;, 11211);<br />
    if(!$cache->get($key)){<br />
        // キャッシュの有効時間は15秒<br />
        $cache->set($key, date(&#8216;Y-m-d h:i:s&#8217;), MEMCACHE_COMPRESSED, 15);<br />
    }<br />
    echo $cache->get($key);<br />
?><br />
[/sourcecode] </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/55.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php： Smartyのdate_formatで前のゼロを表示しない方法</title>
		<link>http://blog.mktime.com/archive/42.html</link>
		<comments>http://blog.mktime.com/archive/42.html#comments</comments>
		<pubDate>Sun, 27 Jul 2008 13:53:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[date_format]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=42</guid>
		<description><![CDATA[Smartyのdate_formatで先頭に0をつけない月と日を出力するには、引数の書式指定部分にそれぞれ&#8221;-&#8221;（マイナス）を付ける。 {$mydate&#124;date_format:'%-m:%-d'} &#8216;%m%d&#8217;なら&#8217;07/05&#8242;になる。 -をつけて&#8217;%-m:%-d&#8217;なら&#8217;7/5&#8242;になる。]]></description>
			<content:encoded><![CDATA[<p>Smartyのdate_formatで先頭に0をつけない月と日を出力するには、引数の書式指定部分にそれぞれ&#8221;-&#8221;（マイナス）を付ける。</p>
<pre>
{$mydate|date_format:'%-m:%-d'}
</pre>
<p>&#8216;%m%d&#8217;なら&#8217;07/05&#8242;になる。<br />
-をつけて&#8217;%-m:%-d&#8217;なら&#8217;7/5&#8242;になる。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/42.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php：PEAR phpunitのインストール</title>
		<link>http://blog.mktime.com/archive/40.html</link>
		<comments>http://blog.mktime.com/archive/40.html#comments</comments>
		<pubDate>Sun, 27 Jul 2008 13:47:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=40</guid>
		<description><![CDATA[足りないPEARライブラリとphp-extensionを入れてから、phpunit/PHPUnitをインストール。 # pear install pear/Image_GraphViz # pear install pear/Log # yum install php-common # yum install php-dom # yum install php-pdo # pear install phpunit/PHPUnit]]></description>
			<content:encoded><![CDATA[<p>足りないPEARライブラリとphp-extensionを入れてから、phpunit/PHPUnitをインストール。</p>
<pre class="console">
# pear install pear/Image_GraphViz
# pear install pear/Log
# yum install php-common
# yum install php-dom
# yum install php-pdo
# pear install phpunit/PHPUnit
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/40.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

