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

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

#extension_dirを設定する
extension_dir = "C:php-5.2.6-Win32ext"

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

拡張を有効にする。php_xdebug.dllも追記する。
extension=php_mbstring.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
</pre>
<h4>PEARを使えるようにする</h4>
<p>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 プロクシサーバ名:ポート番号</p>
<h3>MySQL</h3>
<p>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>
		</item>
	</channel>
</rss>

