<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>仙人の心得 &#187; php</title>
	<atom:link href="http://blog.mktime.com/archive/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mktime.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 31 Aug 2010 12:04:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/tag/php/feed" />
		<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>nak</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 [...]]]></description>
			<content:encoded><![CDATA[<p>
CentOs5.2のリポジトリにmemcachedは無いのでリポジトリを追加する。<br />
<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>
mencachedを入れるのに必要なモジュールをインストールする。<br />
たぶんこのあたりを入れておけばおっけーなはず。<br />
<pre class="console">
yum install gcc
yum install memcached
yum install zlib-devel
yum install php-pecl-memcache
</pre>
<br />
memcachedの設定は/etc/sysconfig/memcachedを編集する。<br />
動かすだけならデフォルトのままでOK。<br />
memcacheの起動<br />
<pre class="console">
/etc/init.d/memcached start
</pre>
<br />
サービスを自動起動にしておく。<br />
<pre class="console">
chkconfig memcached on
</pre>
<br />
テストスクリプト<br />
<pre class="brush: php;">
&lt;?php
    $cache = new Memcache;
    $key = 'cache_test';
    $cache-&gt;connect('localhost', 11211);
    if(!$cache-&gt;get($key)){
        // キャッシュの有効時間は15秒
        $cache-&gt;set($key, date('Y-m-d h:i:s'), MEMCACHE_COMPRESSED, 15);
    }
    echo $cache-&gt;get($key);
?&gt;
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/55.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/55.html" />
	</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>nak</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:%- [...]]]></description>
			<content:encoded><![CDATA[<p>
Smartyのdate_formatで先頭に0をつけない月と日を出力するには、引数の書式指定部分にそれぞれ&#8221;-&#8221;（マイナス）を付ける。<br />
<pre>
{$mydate|date_format:'%-m:%-d'}
</pre>
&#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>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/42.html" />
	</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>nak</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  [...]]]></description>
			<content:encoded><![CDATA[<p>
足りないPEARライブラリとphp-extensionを入れてから、phpunit/PHPUnitをインストール。<br />
<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></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/40.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/40.html" />
	</item>
		<item>
		<title>php:Windows環境でphp.exe＋apache+MySQLの環境を作る</title>
		<link>http://blog.mktime.com/archive/29.html</link>
		<comments>http://blog.mktime.com/archive/29.html#comments</comments>
		<pubDate>Sun, 27 Jul 2008 13:31:05 +0000</pubDate>
		<dc:creator>nak</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://blog.mktime.com/?p=29</guid>
		<description><![CDATA[
php

php.netからバイナリをダウンロードする。
インストーラでもいいけど、とりあえずzipにしとく。

解凍したらフォルダごと適当なところに移動する。（以降、仮にC:\php-5.2.6-Win32に置いたと [...]]]></description>
			<content:encoded><![CDATA[<p>
<h3>php</h3>
<br />
php.netからバイナリをダウンロードする。<br />
インストーラでもいいけど、とりあえずzipにしとく。<br />
<br />
解凍したらフォルダごと適当なところに移動する。（以降、仮にC:\php-5.2.6-Win32に置いたと仮定して読んでください。）<br />
フォルダの中にあるphp.ini-recommendedをコピーしてphp.iniに名前を変える<br />
<br />
<h3>apache</h3>
apache.orgから現在の最新版Apache2.2のWindows用インストーラをダウンロード＆実行する。<br />
オプションは適当に選ぶ。<br />
<br />
httpd.confに設定を追加する。<br />
標準のパスでインストールしたなら、C:\Program Files\Apache Software Foundation\Apache2.2\conf\に設定ファイルhttpd.confがある。<br />
以下の設定を追記する。<br />
<pre class="file">
LoadModule php5_module "C:\php-5.2.6-Win32\php5apache2_2.dll"
PHPIniDir "C:\php-5.2.6-Win32"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</pre>
linux環境の&#8221;httpd configtest&#8221;に変わるコマンドは<br />
<pre class="console">
httpd.exe -t
</pre>
このコマンドを実行して&#8221;Syntax OK&#8221;が表示されることを確認する。<br />
OKならapacheを再起動する。<br />
<pre class="console">
httpd.exe -k restart
</pre>
<br />
公開ディレクトリにtest用のphpファイルを置いて、phpが実行されていればOKです。<br />
<br />
<br />
XdebugをWindows環境で使うには<br />
<a href="http://pecl4win.php.net/ext.php/php_xdebug.dll">http://pecl4win.php.net/ext.php/php_xdebug.dll</a><br />
からphp_xdebug.dllをダウンロードしてエクステンションDirに保存する。<br />
<br />
<h4>エクステンションとPEARを使う＆開発環境用にphp.iniを編集する</h4>
<div class="caption">php.ini</div>
<pre class="file">
#pearディレクトリをinlude_pathに入れる
include_path = ".:C:\php-5.2.6-Win32\pear"

#開発用にdisplay_errorsをOnにする
display_errors = On

#extension_dirを設定する
extension_dir = "C:\php-5.2.6-Win32\ext"

#エラーログを出力する
error_log = php_error.log

拡張を有効にする。php_xdebug.dllも追記する。
extension=php_mbstring.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
</pre>
<br />
<h4>PEARを使えるようにする</h4>
1.go-pear.batを実行して適当に進める。<br />
2.PEAR_ENV.regをダブルクリックしてレジストリに登録する。<br />
3.環境変数pathにpear.batがあるディレクトリを追加する。<br />
4.コマンドプロンプトで &#8220;pear list&#8221;コマンドが通ればOK。<br />
5.プロクシ環境ならpear configにプロクシ設定を行う。<br />
pear config-set http_proxy プロクシサーバ名:ポート番号<br />
<br />
<h3>MySQL</h3>
mysql.comからMySQL Community ServerのWindouws用Setup.exeをダウンロードします。<br />
ウィザードに従ってインストールします。<br />
インストールが終わるとそのまま設定ウィザードに続くので適当に。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mktime.com/archive/29.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.mktime.com/archive/29.html" />
	</item>
	</channel>
</rss>
