<?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>cap&#039;n webb &#187; PHP</title>
	<atom:link href="http://blog.dataich.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dataich.com</link>
	<description>almost all things about it</description>
	<lastBuildDate>Thu, 12 Jan 2012 03:38:00 +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でbundlerぽいことを行うOnion、Composer</title>
		<link>http://blog.dataich.com/2012/01/12/onion-composer/</link>
		<comments>http://blog.dataich.com/2012/01/12/onion-composer/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 03:34:37 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1145</guid>
		<description><![CDATA[pear.phpunit.de/PHPUnitを依存関係として設定する前提で、Onion、Composerを使ってみました。 Onion PEARモジュールのビルド、コンパイル、そして今回の目的であるbundler的なこ [...]]]></description>
			<content:encoded><![CDATA[<p>pear.phpunit.de/PHPUnitを依存関係として設定する前提で、<a href="https://github.com/c9s/Onion" onclick="pageTracker._trackPageview('/outgoing/github.com/c9s/Onion?referer=');">Onion</a>、<a href="https://github.com/composer/composer" onclick="pageTracker._trackPageview('/outgoing/github.com/composer/composer?referer=');">Composer</a>を使ってみました。</p>
<h3>Onion</h3>
<p>PEARモジュールのビルド、コンパイル、そして今回の目的であるbundler的なことを簡単に行えます。</p>
<h4>インストール</h4>
<h5>homebrewの場合</h5>
<p>gistにFormulaを置きましたので使ってください。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--HEAD</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>gist<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1594321</span><span style="color: #000000; font-weight: bold;">/</span>6769fa97864462c4813f06bbb08760630ba7c87f<span style="color: #000000; font-weight: bold;">/</span>onion.rb</pre></div></div>

<h5>直接</h5>
<p>onion.pharをパスの通ったディレクトリに置いて、実行権限を与えるだけ。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>c9s<span style="color: #000000; font-weight: bold;">/</span>Onion<span style="color: #000000; font-weight: bold;">/</span>raw<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>onion.phar <span style="color: #000000; font-weight: bold;">&amp;</span>gt; ~<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>onion.phar</pre></div></div>

<h4>使用方法</h4>
<blockquote><p>
onion_sample<br />
  |&#8211; vendor<br />
  |&#8211; package.ini
</p></blockquote>
<p>プロジェクト直下にpackage.iniを作成し、ここに依存関係などを記述します。<br />
<script type="text/javascript" src="https://gist.github.com/1598335.js?file=package.ini"></script>packageセクションにあるname、desc、version、authorは必須となっています。（そもそもOnionはPEARパッケージを作る際にも使うためだと思われます。） requireセクションに使用したいPEARパッケージを記述します。 上記の状態で下記コマンドを実行することで、vendorディレクトリにPEARパッケージがインストールされます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ onion.phar <span style="color: #660033;">-d</span> bundle</pre></div></div>

<p>いやー、インストールから実行まで非常に手軽。この手軽さが素晴らしいです。 </p>
<h3>Composer</h3>
<p>こちらもbundler的な事を行えるのですが、Onionよりもその依存関係部分に注力したパッケージマネージャといった感じです。 PEARだけに限らず、gitのリポジトリを依存関係として指定したりもできます。ただその辺りはあまり調べていないので、今回はPEARパッケージのみ使う前提で試して見ました。 </p>
<h4>インストール</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--HEAD</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>gist<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1574469</span><span style="color: #000000; font-weight: bold;">/</span>composer.rb</pre></div></div>

<h4>使用方法</h4>
<blockquote><p>
composer_sample<br />
  |&#8211; vendor<br />
  |&#8211; composer.json
</p></blockquote>
<p>プロジェクト直下にcomposer.jsonを作成し、ここに依存関係などを記述します。<script type="text/javascript" src="https://gist.github.com/1598338.js?file=composer.json"></script></p>
<p>上記の状態で下記コマンドを実行することで、vendorディレクトリにPEARパッケージがインストールされます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ composer.phar <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>ComposerはPEARモジュール以外も扱うためか、PEARモジュールそのものを扱うのに設定ファイルが少々複雑になります。<br />
今回はpear.phpunit.de/PHPUnitを依存関係として設定していますが、まずそのためにrepositoriesにチャンネルを設定する必要があります。そこまではいいのですが、PHPUnitがpear.symfony-project.com/YAMLに依存しているので、そのチャンネルも記述しておく必要があります。つまり依存関係にある全てのチャンネルを設定しておく必要があるみたいです。これどうにかならないのでしょうか。</p>
<p>雑感としてはPEARモジュールさえ扱えればいいのであれば、Onionの方が簡単だと思いました。対してComposerはPEARモジュール以外にも使えるので、今後に期待できるのはComposerだと思いますが、現状は用途に合わせてといったところでしょう。また気になる動きとして、OnionのGithubリポジトリにcomposer-supportというブランチがあるのが楽しみです。</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2012/01/12/onion-composer/&via=dataich&text=PHPでbundlerぽいことを行うOnion、Composer&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2012/01/12/onion-composer/_via=dataich_text=PHP_bundler_Onion_Composer_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2012/01/12/onion-composer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpenv+php-build+pyrusでの複数バージョンPHP管理など</title>
		<link>http://blog.dataich.com/2012/01/11/multiple-versions-php-phpenv-phpbuild-pyrus/</link>
		<comments>http://blog.dataich.com/2012/01/11/multiple-versions-php-phpenv-phpbuild-pyrus/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 14:51:42 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1110</guid>
		<description><![CDATA[必要なもの phpenv PHPのバージョン切り替え（切り替えるのみ、PHPのインストールはできない。rbenvを流用） php-build 複数バージョンPHPのインストールマネージャ Pyrus PEAR後継パッケー [...]]]></description>
			<content:encoded><![CDATA[<h2>必要なもの</h2>
<ul>
<li>phpenv<br />
PHPのバージョン切り替え（切り替えるのみ、PHPのインストールはできない。rbenvを流用）</li>
<li>php-build<br />
複数バージョンPHPのインストールマネージャ</li>
<li>Pyrus<br />
PEAR後継パッケージマネージャ</li>
</ul>
<h2>phpenvのインストール</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ curl https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>CHH<span style="color: #000000; font-weight: bold;">/</span>phpenv<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>phpenv-install.sh <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sh</span>
Installing phpenv <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv
remote: Counting objects: <span style="color: #000000;">1008</span>, done.
remote: Compressing objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">422</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">422</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
remote: Total <span style="color: #000000;">1008</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">633</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, reused <span style="color: #000000;">928</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>delta <span style="color: #000000;">558</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Receiving objects: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1008</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1008</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, <span style="color: #000000;">135.47</span> KiB <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">124</span> KiB<span style="color: #000000; font-weight: bold;">/</span>s, done.
Resolving deltas: <span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">633</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">633</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>, done.
Success.
&nbsp;
Now add <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>bin to your <span style="color: #007800;">$PATH</span>, add <span style="color: #ff0000;">&quot;eval <span style="color: #007800;">$(phpenv init -)</span>&quot;</span> at the end of your ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc and restart your shell to use phpenv.</pre></div></div>

<p>最後の行で言われたとおり、.bashrcに追記します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/Users/dataich/.phpenv/bin:<span style="color: #007800;">$PATH</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(phpenv init -)</span>&quot;</span></pre></div></div>

<p>phpenvは~/.phpenv以下にインストールされており、~/.phpenv/versionsにバージョンごとのPHPをインストールしてやることで切り替えが可能になります。</p>
<h2>php-buildのインストール</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">git</span> clone https:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>CHH<span style="color: #000000; font-weight: bold;">/</span>php-build.git
$ <span style="color: #7a0874; font-weight: bold;">cd</span> php-build
$ .<span style="color: #000000; font-weight: bold;">/</span>install.sh
Installing php-build <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
- Creating Directories... Done.
- Copying files... Done.</pre></div></div>

<p>これで必要なもののインストールは完了です。また、現状はインストールできるPHPバージョンが増えたりした場合は、git pullして./install.shを再度実行しないといけないと思います。</p>
<h2>php-buildを使用してPHPをインストール</h2>
<p>まずはインストール可能なバージョンを調べます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ php-build <span style="color: #660033;">--definitions</span>
5.2.17
5.3.2
5.3.6
5.3.8
5.3.9RC3
5.3snapshot
5.4.0RC1
5.4.0RC2
5.4.0RC3
5.4.0RC4
5.4.0alpha3
5.4.0beta1
5.4.0beta2
5.4snapshot</pre></div></div>

<p>では上記から好きなバージョンを選んでインストールしています。今回は業務で必須なので5.3.8を。</p>
<h2>とその前にApacheモジュールどうする？</h2>
<p>php-buildはApacheモジュールのビルドに対応していません（GitHubにIssueにはFeatureとして登録されてます。）。<br />
ソースを読んでみるconfigure_optionを呼び出してあげればよさそうです。なのでdefinitionsに定義してあるスクリプトに変更を入れてあげます。このdefinitions配下にあるスクリプトはいろいろビルド方法を調整する時に使えそうです（pyrusじゃなくてpear使いたかったらwith_pear書いて、install_pyrusコメントアウトするとか。）</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>php-build<span style="color: #000000; font-weight: bold;">/</span>definitions<span style="color: #000000; font-weight: bold;">/</span>5.3.8
configure_option <span style="color: #ff0000;">&quot;--with-apxs2&quot;</span> <span style="color: #ff0000;">&quot;/usr/local/Cellar/httpd/2.2.21/sbin/apxs&quot;</span> <span style="color: #666666; font-style: italic;">#この行を追加する。apxsへのパスは環境に応じて置き換えてください。</span>
install_package <span style="color: #ff0000;">&quot;http://www.php.net/distributions/php-5.3.8.tar.bz2&quot;</span>
install_pyrus
&nbsp;
install_xdebug <span style="color: #ff0000;">&quot;2.1.2&quot;</span></pre></div></div>

<p>まあPHPをビルドする度にlibphp5.soを上書きしてしまうだろうということと、phpenvで切り替えた時どうするのっていうのはありますが・・・。</p>
<h2>気をとりなおしてphp-buildを使用してPHPをインストール</h2>
<p>ではphp-buildを使用して5.3.8をインストールします。プレフィックスには~/.phpenv/versions/5.3.8を指定します。実はここでちょっとはまったのですが、最後の引数はプレフィックスなのでフルパスである必要があります。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ php-build 5.3.8 ~<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8
Loaded pyrus Plugin.
Loaded xdebug Plugin.
php.ini-production gets used <span style="color: #c20cb9; font-weight: bold;">as</span> php.ini
&nbsp;
Building 5.3.8 into <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Downloading<span style="color: #7a0874; font-weight: bold;">&#93;</span>: http:<span style="color: #000000; font-weight: bold;">//</span>www.php.net<span style="color: #000000; font-weight: bold;">/</span>distributions<span style="color: #000000; font-weight: bold;">/</span>php-5.3.8.tar.bz2
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Configure<span style="color: #7a0874; font-weight: bold;">&#93;</span>: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>php-build<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>5.3.8
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Make<span style="color: #7a0874; font-weight: bold;">&#93;</span>: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>php-build<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>5.3.8
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Pyrus<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Downloading from http:<span style="color: #000000; font-weight: bold;">//</span>pear2.php.net<span style="color: #000000; font-weight: bold;">/</span>pyrus.phar
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Pyrus<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Installing executable <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pyrus
<span style="color: #7a0874; font-weight: bold;">&#91;</span>XDebug<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Downloading http:<span style="color: #000000; font-weight: bold;">//</span>xdebug.org<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>xdebug-2.1.2.tgz
<span style="color: #7a0874; font-weight: bold;">&#91;</span>XDebug<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Compiling <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>php-build<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>xdebug-2.1.2
<span style="color: #7a0874; font-weight: bold;">&#91;</span>XDebug<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Installing XDebug configuration <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>conf.d<span style="color: #000000; font-weight: bold;">/</span>xdebug.ini
<span style="color: #7a0874; font-weight: bold;">&#91;</span>XDebug<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Cleaning up.
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Info<span style="color: #7a0874; font-weight: bold;">&#93;</span>: The Log File is not empty, but the Build did not fail. Maybe just warnings got logged. You can review the log <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>php-build<span style="color: #000000; font-weight: bold;">/</span>error.5.3.8.20120106174319.log
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Success<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Built 5.3.8 successfully.</pre></div></div>

<p>ちなみにphp.iniは~/.phpenv/versions/5.3.8/etc配下のを使うようになっています。また~/.phpenv/versions/5.3.8/etc/conf.d配下のものも読むようになっており、xdebug.iniなどが置いてあります。バージョンごとにiniファイルを持っているので便利です。</p>
<h2>phpenvを使ってみる</h2>
<p>ではphpenvにて切り替えられるバージョンを調べてみます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpenv versions
5.3.8</pre></div></div>

<p>先ほどインスールした5.3.8が使用できる状態になっていますので、グローバルに使うようにします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpenv global 5.3.8
$ phpenv versions
<span style="color: #000000; font-weight: bold;">*</span> 5.3.8 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">set</span> by <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.rbenv-version<span style="color: #7a0874; font-weight: bold;">&#41;</span>
$ php <span style="color: #660033;">-v</span>
PHP 5.3.8 <span style="color: #7a0874; font-weight: bold;">&#40;</span>cli<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>built: Jan <span style="color: #000000;">11</span> <span style="color: #000000;">2012</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">20</span>:<span style="color: #000000;">46</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1997</span>-<span style="color: #000000;">2011</span> The PHP Group
Zend Engine v2.3.0, Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1998</span>-<span style="color: #000000;">2011</span> Zend Technologies
with Xdebug v2.1.2, Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">2002</span>-<span style="color: #000000;">2011</span>, by Derick Rethans</pre></div></div>

<p>また、下記のようにlocalを使うとカレントディレクトリに.rbenv-versionというファイルが作られ、そのディレクトリ配下では一度指定したバージョンが使われるようになります。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpenv <span style="color: #7a0874; font-weight: bold;">local</span> 5.4snapshot</pre></div></div>

<h2>phpenv rehashコマンド</h2>
<p>phpenvでは.phpenv/shims/にパスを通すようになっており、そこを介してexecutableなコマンドを実行したりします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ll .phpenv<span style="color: #000000; font-weight: bold;">/</span>shims</pre></div></div>

<p>何もないはずです。ここを構築するにはrehashを使います。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpenv rehash
$ ll .phpenv<span style="color: #000000; font-weight: bold;">/</span>shims<span style="color: #000000; font-weight: bold;">/</span>
total <span style="color: #000000;">56</span>
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> phar
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> phar.phar
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> php
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> php-config
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> phpize
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> pyrus
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">7</span> dataich staff <span style="color: #000000;">102</span> <span style="color: #000000;">1</span> <span style="color: #000000;">11</span> <span style="color: #000000;">23</span>:<span style="color: #000000;">31</span> pyrus.phar</pre></div></div>

<p>これを実行することでインストールされているPHPやPEARモジュールの実体を探してきて、シムリンクぽいシェルスクリプトが作成されます。新しいバージョンのPHPや、phpunitなどの実行モジュールをインストールした後には実行しておきましょう。</p>
<h2>Pyrus</h2>
<p>で次にPyrusです。PEARの後継にあたるパッケージマネージャです。使ってみます。<br />
php-buildでインストールした際に既に使えるようになっています。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ pyrus config-show
Pyrus version 2.0.0a3 SHA-<span style="color: #000000;">1</span>: BE7EA9D171AE3873F1BBAF692EEE9165BB14BD5D
Using PEAR installation found at <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus
System paths:
php_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>php
ext_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>extensions<span style="color: #000000; font-weight: bold;">/</span>no-debug-non-zts-<span style="color: #000000;">20090626</span>
cfg_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>cfg
doc_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>docs
bin_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>
data_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>data
www_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>www
test_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>tests
src_dir =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>pyrus<span style="color: #000000; font-weight: bold;">/</span>src
php_bin =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php
php_ini =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini
php_prefix =<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>dataich<span style="color: #000000; font-weight: bold;">/</span>.phpenv<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>
php_suffix =<span style="color: #000000; font-weight: bold;">&gt;</span>
...</pre></div></div>

<p>パッケージのインストール先ディレクトリ等がphpenvで指定している現在のバージョン配下になっています、素晴らしい！これでPEARモジュールは現在使用中のPHPのバージョン配下に収まることになります。</p>
<p>pyrusコマンドは第一引数にディレクトリを渡してやることで、そのディレクトリローカルなパッケージ管理ができるようになるので、非常に便利です。ただphp-buildが生成するshimにバグがあって、使えない状態だったのですが、作者さんに投げたところ数時間で対応していただきました、これで常用できそうです。<br />
<a href="https://github.com/CHH/php-build/issues/35" onclick="pageTracker._trackPageview('/outgoing/github.com/CHH/php-build/issues/35?referer=');">#35: Cannot use pyrus locally &#8211; Issues &#8211; CHH/php-build &#8211; GitHub</a></p>
<p>ただし現状Pyrusだとプロジェクトローカルなインストールは簡単なのですが、依存関係の設定ファイルだけリポジトリに上げておいて、コマンド一発で全部インストールみたいなことが難しいです。package.xmlを作ればできるようなのですが、そもそもPEARモジュールのビルド用ぽくて、扱いが難しいです。次のエントリーではその辺りを上手く解決してくれる、Onion、Composer辺り扱ってみます。</p>
<h2>参考</h2>
<p><a href="http://blog.yuyat.jp/archives/1446" onclick="pageTracker._trackPageview('/outgoing/blog.yuyat.jp/archives/1446?referer=');">phpenv で複数の PHP 環境を管理する</a><br />
<a href="http://blog.yuyat.jp/archives/1376" onclick="pageTracker._trackPageview('/outgoing/blog.yuyat.jp/archives/1376?referer=');">php-build で PHP 5.4.0 beta1 をビルドする</a><br />
<a href="http://saltybeagle.com/2011/01/using-pyrus-to-manage-pear-installable-vendor-libs/" onclick="pageTracker._trackPageview('/outgoing/saltybeagle.com/2011/01/using-pyrus-to-manage-pear-installable-vendor-libs/?referer=');">Using Pyrus To Manage PEAR Installable Vendor Libs</a></p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2012/01/11/multiple-versions-php-phpenv-phpbuild-pyrus/&via=dataich&text=phpenv+php-build+pyrusでの複数バージョンPHP管理など&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2012/01/11/multiple-versions-php-phpenv-phpbuild-pyrus/_via=dataich_text=phpenv+php-build+pyrus_PHP_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2012/01/11/multiple-versions-php-phpenv-phpbuild-pyrus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPUnit_Storyで振舞駆動開発なテストを書いてみた</title>
		<link>http://blog.dataich.com/2011/12/09/bdd-with-phpunit_story/</link>
		<comments>http://blog.dataich.com/2011/12/09/bdd-with-phpunit_story/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 15:06:57 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[テスト]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1096</guid>
		<description><![CDATA[テスト対象としてEntryクラスを作成しました。 ステータス（下書き・公開済・削除）を持つ。 初期ステータスは下書き ステータスはメソッドを通じて変更できる。 まずはテスト駆動開発なテストを行う簡単なテストケースを書いて [...]]]></description>
			<content:encoded><![CDATA[<p>テスト対象としてEntryクラスを作成しました。</p>
<ul>
<li>ステータス（下書き・公開済・削除）を持つ。</li>
<li>初期ステータスは下書き</li>
<li>ステータスはメソッドを通じて変更できる。</li>
</ul>
<p><script src="https://gist.github.com/1447145.js?file=Entry.php"></script></p>
<div>まずはテスト駆動開発なテストを行う簡単なテストケースを書いてみました。こんなコードになります。</div>
<p><script src="https://gist.github.com/1447145.js?file=EntryTest.php"></script></p>
<div>実行結果はこうなります。</div>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpunit <span style="color: #660033;">--debug</span> EntryTest.php 
PHPUnit 3.6.2 by Sebastian Bergmann.
&nbsp;
&nbsp;
Starting <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #ff0000;">'EntryTest::testStatus'</span>.
.
&nbsp;
Time: <span style="color: #000000;">0</span> seconds, Memory: 5.50Mb
&nbsp;
OK <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">test</span>, <span style="color: #000000;">3</span> assertions<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>これを振舞駆動開発なテストで書きなおしてみました。PHPUnit_Extensions_Story_TestCaseをextendsし、runGiven、runWhen、runThenを実装する必要があります。<br />
<script src="https://gist.github.com/1447145.js?file=EntrySpec.php"></script></p>
<div>実行結果はこうです。なんかそれっぽくなりました</div>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ phpunit <span style="color: #660033;">--debug</span> <span style="color: #660033;">--verbose</span> <span style="color: #660033;">--printer</span> PHPUnit_Extensions_Story_ResultPrinter_Text EntrySpec.php
PHPUnit 3.6.2 by Sebastian Bergmann.
&nbsp;
EntrySpec
 <span style="color: #7a0874; font-weight: bold;">&#91;</span>x<span style="color: #7a0874; font-weight: bold;">&#93;</span> Status <span style="color: #000000; font-weight: bold;">for</span> new entry is draft
&nbsp;
   Given New Entry 
    Then Status should be draft
&nbsp;
 <span style="color: #7a0874; font-weight: bold;">&#91;</span>x<span style="color: #7a0874; font-weight: bold;">&#93;</span> Status after publish entry is published
&nbsp;
   Given Some Entry 
    When publish Entry 
    Then Status should be published
&nbsp;
 <span style="color: #7a0874; font-weight: bold;">&#91;</span>x<span style="color: #7a0874; font-weight: bold;">&#93;</span> Status after delete entry is deleted
&nbsp;
   Given Some Entry 
    When delete Entry 
    Then Status should be deleted
&nbsp;
Scenarios: <span style="color: #000000;">3</span>, Failed: <span style="color: #000000;">0</span>, Skipped: <span style="color: #000000;">0</span>, Incomplete: <span style="color: #000000;">0</span>.</pre></div></div>

<p>パッと見、コード量が多くなってしまいましたが、テスト対象がサンプル程度なので。実装が増えてきたときに、runGiven、runWhen、runThenを良い感じに使いまわせるようにすると、効果大きそうです。<br />
ちなみにPHPUnit、PHPUnit_StoryともにPEARでサクッとインストール可能です。</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2011/12/09/bdd-with-phpunit_story/&via=dataich&text=PHPUnit_Storyで振舞駆動開発なテストを書いてみた&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2011/12/09/bdd-with-phpunit_story/_via=dataich_text=PHPUnit_Story_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2011/12/09/bdd-with-phpunit_story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HomebrewでApache2.2+MySQL5.1+PHP5.3環境を構築</title>
		<link>http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/</link>
		<comments>http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 13:48:09 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1081</guid>
		<description><![CDATA[残念ながらHomebrewのリポジトリにはApache、PHPがなく、MySQLは5.5となっています。もっともApacheとPHPに関しては、システムに入ってるものはインストールしないというHomebrewの方針なんだ [...]]]></description>
			<content:encoded><![CDATA[<p>残念ながらHomebrewのリポジトリにはApache、PHPがなく、MySQLは5.5となっています。もっともApacheとPHPに関しては、システムに入ってるものはインストールしないというHomebrewの方針なんだろうと思いますが。で探し回っているとこんなものを見つけました。</p>
<blockquote><p>Alternate formulae repos for Homebrew<br />
<a href="https://github.com/adamv/homebrew-alt/" onclick="pageTracker._trackPageview('/outgoing/github.com/adamv/homebrew-alt/?referer=');">https://github.com/adamv/homebrew-alt/</a></p></blockquote>
<p>homebrewのリポジトリにはないものを野良的に公開してくださっています。上記利用させていただいて、MAMP環境を構築します。</p>
<h3>PHP5.3のインストール</h3>
<p>HomebrewはFomulaの直URL指定でもインストールすることができます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>adamv<span style="color: #000000; font-weight: bold;">/</span>homebrew-alt<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>duplicates<span style="color: #000000; font-weight: bold;">/</span>php.rb <span style="color: #660033;">--with-mysql</span></pre></div></div>

<p>ちなみにduplicatesディレクトリに入っているFomulaは、OS Xに標準で入っているものが集められています。</p>
<h3>MySQL5.1のインストール</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>adamv<span style="color: #000000; font-weight: bold;">/</span>homebrew-alt<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>mysql51.rb <span style="color: #660033;">--with-utf8-default</span> <span style="color: #660033;">--use-gcc</span></pre></div></div>

<h5>初期設定</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">unset</span> TMPDIR
mysql_install_db</pre></div></div>

<h5>起動・停止</h5>
<p>私は、自動起動はさせたくなかったので、launchdには登録しませんでした。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql.server start
mysql.server stop</pre></div></div>

<h3>Apache2.2のインストール</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>adamv<span style="color: #000000; font-weight: bold;">/</span>homebrew-alt<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>duplicates<span style="color: #000000; font-weight: bold;">/</span>httpd.rb</pre></div></div>

<p>httpd.conf等は/usr/local/Cellar/httpd/2.2.21/etc/apache2にあります。</p>
<h5>PHPなどの設定</h5>
<p>私の場合は、extra/php.confを作成し、httpd.confにてIncludeするようにしています。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>2.2.21<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>extra<span style="color: #000000; font-weight: bold;">/</span>php.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LoadModule php5_module <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>libphp5.so
AddType application<span style="color: #000000; font-weight: bold;">/</span>x-httpd-php .php .php5 .phtml</pre></div></div>

<p>その他に、DocumentRootを/Users/dataich/Sitesという風にユーザーホームのSitesディレクトリを使用するようにしました。この辺りはお好みで。</p>
<h5>起動・停止</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apachectl start
<span style="color: #c20cb9; font-weight: bold;">sudo</span> apachectl stop</pre></div></div>

<p>あとは、phpinfo()で出力してみたりして確認すればOKです。</p>
<p><strong>追記 &#8211; 2011/11/08</strong><br />
Homebrewで入れたPHPのpearでpermissionエラーが出ましたので、下記でもろもろ設定しました。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> ug+<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php
pear config-set php_ini <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></div></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/&via=dataich&text=HomebrewでApache2.2+MySQL5.1+PHP5.3環境を構築 &related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/_via=dataich_text=Homebrew_Apache2.2+MySQL5.1+PHP5.3_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CORESERVERからdotCloudにWordPressをお引っ越し</title>
		<link>http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/</link>
		<comments>http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 13:03:48 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[dotCloud]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1039</guid>
		<description><![CDATA[dotCloudがプライベートベータから正式リリースに至り、ベータの頃からのユーザには1年間のProアカウントを発行してくれるということで、PaaSの運用テストを兼ねて、引っ越してみることにしました。個人ではお高いのでず [...]]]></description>
			<content:encoded><![CDATA[<p>dotCloudがプライベートベータから正式リリースに至り、ベータの頃からのユーザには1年間のProアカウントを発行してくれるということで、PaaSの運用テストを兼ねて、引っ越してみることにしました。個人ではお高いのでずっとは使えませんが。。。</p>
<h3>CORESERVERでやること</h3>
<p>まずは、CORESERVER側のWordpressを本体、プラグインともに最新にアップデートしました。<br />
この状態でCORESERVERの管理画面からWordpressデータベースのダンプを取ってローカルに持ってきます。<br />
また、CORESERVER上のWordpressディレクトリもごっそりローカルに持ってきました。</p>
<h3>dotCloud基本設定</h3>
<p>ここからがdotCloudに対して行う作業です。<br />
ここではアプリケーション名をwordpressとしています。</p>
<p>dotCloudにアプリケーションを作成します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud create wordpress
Created application <span style="color: #ff0000;">&quot;wordpress&quot;</span></pre></div></div>

<p>ローカルにディレクトリを作成します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> blog.dataich.com</pre></div></div>

<p>ここにサービスの設定や、ソースコード等を置いていきます。</p>
<p>WordPressに必要なサービスPHP、MySQLの設定を行います。dotcloud.ymlに記述します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>dotcloud.yml</pre></div></div>

<p><script type="text/javascript" src="https://gist.github.com/1119565.js?file=dotcloud.yml"></script></p>
<p>まずはこの状態で動きを確認してみます。 dotcloud pushコマンドでアプリケーションのソースコード（とはいってもこの段階ではdotcloud.ymlのみ）をPushします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud push wordpress blog.dataich.com
<span style="color: #666666; font-style: italic;"># upload blog.dataich.com ssh://dotcloud@uploader.dotcloud.com:21122/wordpress</span>
<span style="color: #666666; font-style: italic;"># rsync</span>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added <span style="color: #ff0000;">'[uploader.dotcloud.com]:21122,[184.73.14.49]:21122'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
building <span style="color: #c20cb9; font-weight: bold;">file</span> list ... <span style="color: #000000; font-weight: bold;">done</span>
.<span style="color: #000000; font-weight: bold;">/</span>
dotcloud.yml
&nbsp;
sent <span style="color: #000000;">188</span> bytes  received <span style="color: #000000;">54</span> bytes  <span style="color: #000000;">9.88</span> bytes<span style="color: #000000; font-weight: bold;">/</span>sec
total <span style="color: #c20cb9; font-weight: bold;">size</span> is <span style="color: #000000;">52</span>  speedup is <span style="color: #000000;">0.21</span>
Deployment <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">&quot;wordpress&quot;</span> triggered. Will be available <span style="color: #000000; font-weight: bold;">in</span> a few seconds.
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:04:<span style="color: #000000;">54</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>api<span style="color: #7a0874; font-weight: bold;">&#93;</span> Waiting <span style="color: #000000; font-weight: bold;">for</span> the build. <span style="color: #7a0874; font-weight: bold;">&#40;</span>It may take a few minutes<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:04:<span style="color: #000000;">54</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Deploying...
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:04:<span style="color: #000000;">54</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Deploying...
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">25</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Service booted
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">35</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Service booted
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">35</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>api<span style="color: #7a0874; font-weight: bold;">&#93;</span> All the services are ready. Beginning the build.
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build started
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> This service <span style="color: #7a0874; font-weight: bold;">type</span> does not support build method, ignoring...
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build finished successfully
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build started
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Fetched code revision rsync-<span style="color: #000000;">1312214692.31</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">37</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Updating channel <span style="color: #ff0000;">&quot;doc.php.net&quot;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">37</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Update of Channel <span style="color: #ff0000;">&quot;doc.php.net&quot;</span> succeeded
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">37</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Updating channel <span style="color: #ff0000;">&quot;pear.php.net&quot;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Channel <span style="color: #ff0000;">&quot;pear.php.net&quot;</span> is up to <span style="color: #c20cb9; font-weight: bold;">date</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Updating channel <span style="color: #ff0000;">&quot;pecl.php.net&quot;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Update of Channel <span style="color: #ff0000;">&quot;pecl.php.net&quot;</span> succeeded
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> -su: line <span style="color: #000000;">0</span>: <span style="color: #7a0874; font-weight: bold;">cd</span>: current: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">39</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> -su: line <span style="color: #000000;">0</span>: <span style="color: #7a0874; font-weight: bold;">cd</span>: current: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">39</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Reloading nginx configuration: nginx.
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> php5-fpm: stopped
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> php5-fpm: ERROR <span style="color: #7a0874; font-weight: bold;">&#40;</span>abnormal termination<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build finished successfully
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>api<span style="color: #7a0874; font-weight: bold;">&#93;</span> Deploy finished
&nbsp;
Deployment finished. Your application is available at the following URLs
www: http:<span style="color: #000000; font-weight: bold;">//</span>xxxxxxxx.dotcloud.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>最後の行にサービスwww（PHP）のURLが発行されているので、アクセスしてみます。当然何のリソースもPushしていないので、404が返ってくるかと思います。</p>
<h3>データの移行</h3>
<p>CORESERVERからとったデータベースダンプをdotCloud上のMySQLにロードします。そのためにdotCloudにデータベース、ユーザの作成をしておきます。</p>
<p>まずは、dotcloud infoでMySQLサービスの情報を取得します。ここでは書きませんが、rootパスワードその他情報が表示されるはずです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud info wordpress.data</pre></div></div>

<p>次のコマンドでMySQLのシェルにログインします。</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">dataich:dev dataich$ dotcloud run wordpress.<span style="color: #990099; font-weight: bold;">data</span> <span style="color: #808080; font-style: italic;">-- mysql -u root -p</span>
<span style="color: #808080; font-style: italic;"># mysql -u root -p</span>
Warning: Permanently added <span style="color: #008000;">'[xxxxxxxx.dotcloud.com]:12428,[174.129.17.131]:12428'</span> <span style="color: #FF00FF;">&#40;</span>RSA<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">to</span> the list of known hosts.
Enter <span style="color: #000099;">password</span>:
Welcome <span style="color: #990099; font-weight: bold;">to</span> the MySQL monitor.  Commands <span style="color: #009900;">end</span> <span style="color: #990099; font-weight: bold;">with</span> <span style="color: #000033;">;</span> <span style="color: #CC0099; font-weight: bold;">or</span> \g.
Your MySQL <span style="color: #FF9900; font-weight: bold;">connection</span> id <span style="color: #CC0099; font-weight: bold;">is</span> <span style="color: #008080;">34</span>
Server <span style="color: #000099;">version</span>: 5.1.41<span style="color: #CC0099;">-</span>3ubuntu12.10<span style="color: #CC0099;">-</span><span style="color: #000099;">log</span> <span style="color: #FF00FF;">&#40;</span>Ubuntu<span style="color: #FF00FF;">&#41;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'help;'</span> <span style="color: #CC0099; font-weight: bold;">or</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\h</span>'</span> for <span style="color: #990099; font-weight: bold;">help</span>. <span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\c</span>'</span> <span style="color: #990099; font-weight: bold;">to</span> clear the current input statement.
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span></pre></div></div>

<p>DBを作成します。</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> wordpress<span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">1</span> row affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>ユーザを作成し、権限を与えます。</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">ON</span> wordpress.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'dataich'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'XXXXXXXXXX'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>念のため</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>では、データをロードします。 データをアップし</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud run wordpress.data <span style="color: #ff0000;">&quot;cat &gt; data.sql&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>mysql_wp.dump
<span style="color: #666666; font-style: italic;"># cat &gt; data.sql</span>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added <span style="color: #ff0000;">'[xxxxxxxx.dotcloud.com]:12428,[174.129.17.131]:12428'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.</pre></div></div>

<p>SSHログインし</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud <span style="color: #c20cb9; font-weight: bold;">ssh</span> wordpress.data
<span style="color: #666666; font-style: italic;"># $SHELL</span>
Warning: Permanently added <span style="color: #ff0000;">'[xxxxxxxx.dotcloud.com]:12428,[174.129.17.131]:12428'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
mysql<span style="color: #000000; font-weight: bold;">@</span>wordpress-default-data-<span style="color: #000000;">0</span>:~$</pre></div></div>

<p>ロードします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql<span style="color: #000000; font-weight: bold;">@</span>wordpress-default-data-<span style="color: #000000;">0</span>:~$ mysql <span style="color: #660033;">-u</span> dataich <span style="color: #660033;">-p</span> wordpress <span style="color: #000000; font-weight: bold;">&lt;</span> data.sql</pre></div></div>

<h3>WordPressソースの移行</h3>
<p>アプリケーションのディレクトリにwwwというディレクトリを作り、そこにCORESEVERから持ってきたソースを置きます。</p>
<p>DBの設定を行うため、wp-config.phpを編集します。<br />
dotcloudでは/home/dotcloud/environment.jsonに各種サービスの設定が書かれます。それを読むようにしてあげればOKです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>wp-config.php</pre></div></div>

<p><script src="https://gist.github.com/1119568.js?file=wp-config.php"></script></p>
<h3>nginxの設定</h3>
<p>パーマリンク設定をp=123の形から変えている場合は、nginxの設定が必要になります。それにはnginx.confを置いてあげればOKです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>nginx.conf</pre></div></div>

<p><script type="text/javascript" src="https://gist.github.com/1119570.js?file=nginx.conf"></script></p>
<h3>wp-contentディレクトリの扱い</h3>
<p>このままだと1回目以降にPushした際にwp-content以下が消えてしまいます。それではまずいので、すでにwp-contentディレクトリが存在する場合は何もしないようにpostinstallスクリプトを書いておきます。（dotcloudのヘルプそのまんま）</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>postinstall</pre></div></div>

<p><script src="https://gist.github.com/1119572.js?file=postinstall"></script></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>postinstall</pre></div></div>

<h3>dotCloudへWordpressソースをPush</h3>
<p>これで、動くはず！さあ、Push!!!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud push wordpress blog.dataich.com
<span style="color: #666666; font-style: italic;"># upload blog.dataich.com ssh://dotcloud@uploader.dotcloud.com:21122/wordpress</span>
<span style="color: #666666; font-style: italic;"># rsync</span>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added <span style="color: #ff0000;">'[uploader.dotcloud.com]:21122,[184.73.14.49]:21122'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
building <span style="color: #c20cb9; font-weight: bold;">file</span> list ... <span style="color: #000000; font-weight: bold;">done</span>
.<span style="color: #000000; font-weight: bold;">/</span>
www<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
..
..
..
&nbsp;
www: http:<span style="color: #000000; font-weight: bold;">//</span>xxxxxxxx.dotcloud.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>上記、URLに正しくアクセスできました。</p>
<h3>カスタムドメインの設定</h3>
<p>まずはdotCloud側を設定します。aliasコマンドを使います。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:~ dataich$ dotcloud <span style="color: #7a0874; font-weight: bold;">alias</span> add wordpress.www blog.dataich.com
Ok. Now please add the following DNS record:
blog.dataich.com. IN CNAME gateway.dotcloud.com.</pre></div></div>

<p>CNAMEでgateway.dotcloud.com.を設定するように言われるので、VALUE-DOMAIN側のドメイン設定を行います。</p>
<p>http://blog.dataich.com/</p>
<p>上記にアクセスし、動作確認。無事当ブログをdotCloudで動かすことに成功しました。<br />
ざっと確認したところ問題なし。これで暫く運用テストしてみます。</p>
<p>ここまでやっといてアレなのですが、そう負荷のない個人ブログを運用するにはちょっとお値段が辛いです。<br />
もう少しリーズナブルなプランがあればいいのですが。。</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/&via=dataich&text=CORESERVERからdotCloudにWordpressをお引っ越し&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/_via=dataich_text=CORESERVER_dotCloud_Wordpress_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Irresistible（WordPressテーマ）のバグ</title>
		<link>http://blog.dataich.com/2009/12/05/irresistible-wordpress-theme-bug/</link>
		<comments>http://blog.dataich.com/2009/12/05/irresistible-wordpress-theme-bug/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 17:50:43 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=442</guid>
		<description><![CDATA[ブログのデザインを変えました。 WooThemesからIrresistibleを使わせていただきました。 アーカイブでページャーが表示されないバグがあったので手直し。（「前へ」「次へ」が出ない） archives.php [...]]]></description>
			<content:encoded><![CDATA[<p>ブログのデザインを変えました。<br />
<a href="http://www.woothemes.com/" onclick="pageTracker._trackPageview('/outgoing/www.woothemes.com/?referer=');">WooThemes</a>から<a href="http://www.woothemes.com/2009/02/irresistible/" onclick="pageTracker._trackPageview('/outgoing/www.woothemes.com/2009/02/irresistible/?referer=');">Irresistible</a>を使わせていただきました。</p>
<p>アーカイブでページャーが表示されないバグがあったので手直し。（「前へ」「次へ」が出ない）<br />
archives.phpの41行目あたりのPHPコードの括弧の位置がおかしいので修正。<br />
後の行が修正後。<br />
<script src="http://gist.github.com/249194.js"></script></p>
<p>一応、連絡入れときました。</p>
<p><span id="more-442"></span><strong>The WooThemes Teamの人から連絡があって、早速修正したバージョンをアップしたとのこと。<br />
対応が早いです。</strong></p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2009/12/05/irresistible-wordpress-theme-bug/&via=dataich&text=Irresistible（Wordpressテーマ）のバグ&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2009/12/05/irresistible-wordpress-theme-bug/_via=dataich_text=Irresistible_Wordpress_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2009/12/05/irresistible-wordpress-theme-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>array_filter &#8211; PHPの配列で条件に当てはまる要素を取り出す</title>
		<link>http://blog.dataich.com/2009/03/31/array_filter-php%e3%81%ae%e9%85%8d%e5%88%97%e3%81%a7%e6%9d%a1%e4%bb%b6%e3%81%ab%e5%bd%93%e3%81%a6%e3%81%af%e3%81%be%e3%82%8b%e8%a6%81%e7%b4%a0%e3%82%92%e5%8f%96%e3%82%8a%e5%87%ba%e3%81%99/</link>
		<comments>http://blog.dataich.com/2009/03/31/array_filter-php%e3%81%ae%e9%85%8d%e5%88%97%e3%81%a7%e6%9d%a1%e4%bb%b6%e3%81%ab%e5%bd%93%e3%81%a6%e3%81%af%e3%81%be%e3%82%8b%e8%a6%81%e7%b4%a0%e3%82%92%e5%8f%96%e3%82%8a%e5%87%ba%e3%81%99/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 03:56:20 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=192</guid>
		<description><![CDATA[DBから取って来た結果から、特定条件に当てはまる要素のみ取り出したかったので。 具体的にはフィルタリングするためのコールバック関数を作って、array_filterを実行します。 例）男性であるレコードのみ取り出す場合  [...]]]></description>
			<content:encoded><![CDATA[<p>DBから取って来た結果から、特定条件に当てはまる要素のみ取り出したかったので。<br />
具体的にはフィルタリングするためのコールバック関数を作って、array_filterを実行します。</p>
<p>例）男性であるレコードのみ取り出す場合<br />
<script src="http://gist.github.com/249007.js"></script></p>
<ol>
<li>create_functionでコールバック関数を作成します。create_functionでなくとも普通にfunction作っても構わないのですが、フィルタリングする為の条件を動的に変えたい場合などに有効です。1番目の引数$recordは配列の各要素になります。ここでの変数名は何でも構いません。2番目の引数がコールバック関数の実際の処理部になります。ここでtrueが返る要素のみ取り出されます。</li>
<li>フィルタリングする配列、コールバック関数を引数にし、array_filterにて実際に要素をフィルタリングしています。その結果を$male_onlyに代入します。</li>
</ol>
<p>結果</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>
    <span style="color: #009900;">&#40;</span>
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
            <span style="color: #009900;">&#40;</span>
                <span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> 田中　太郎
                <span style="color: #009900;">&#91;</span>sex<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span>
            <span style="color: #009900;">&#41;</span>
&nbsp;
        <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">Array</span>
            <span style="color: #009900;">&#40;</span>
                <span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> 鈴木　太郎
                <span style="color: #009900;">&#91;</span>sex<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span>
            <span style="color: #009900;">&#41;</span>
&nbsp;
    <span style="color: #009900;">&#41;</span></pre></div></div>

<p>*添字が元のままであることに注意</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2009/03/31/array_filter-php%e3%81%ae%e9%85%8d%e5%88%97%e3%81%a7%e6%9d%a1%e4%bb%b6%e3%81%ab%e5%bd%93%e3%81%a6%e3%81%af%e3%81%be%e3%82%8b%e8%a6%81%e7%b4%a0%e3%82%92%e5%8f%96%e3%82%8a%e5%87%ba%e3%81%99/&via=dataich&text=array_filter - PHPの配列で条件に当てはまる要素を取り出す&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2009/03/31/array_filter-php_e3_81_ae_e9_85_8d_e5_88_97_e3_81_a7_e6_9d_a1_e4_bb_b6_e3_81_ab_e5_bd_93_e3_81_a6_e3_81_af_e3_81_be_e3_82_8b_e8_a6_81_e7_b4_a0_e3_82_92_e5_8f_96_e3_82_8a_e5_87_ba_e3_81_99/_via=dataich_text=array_filter_-_PHP_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2009/03/31/array_filter-php%e3%81%ae%e9%85%8d%e5%88%97%e3%81%a7%e6%9d%a1%e4%bb%b6%e3%81%ab%e5%bd%93%e3%81%a6%e3%81%af%e3%81%be%e3%82%8b%e8%a6%81%e7%b4%a0%e3%82%92%e5%8f%96%e3%82%8a%e5%87%ba%e3%81%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPでのunpack</title>
		<link>http://blog.dataich.com/2008/04/25/php%e3%81%a7%e3%81%aeunpack/</link>
		<comments>http://blog.dataich.com/2008/04/25/php%e3%81%a7%e3%81%aeunpack/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 02:30:00 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2008/04/25/php%e3%81%a7%e3%81%aeunpack/</guid>
		<description><![CDATA[PHPでのunpackがperlと少し違った。 perlでは PHPでは 両方とも出力結果は 12345 1234567 12 Tweet]]></description>
			<content:encoded><![CDATA[<p>PHPでのunpackがperlと少し違った。</p>
<h4>perlでは</h4>
<p><script src="http://gist.github.com/249009.js"></script></p>
<h4>PHPでは</h4>
<p><script src="http://gist.github.com/249010.js"></script></p>
<h4>両方とも出力結果は</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">12345</span> <span style="color: #000000;">1234567</span> <span style="color: #000000;">12</span></pre></div></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2008/04/25/php%e3%81%a7%e3%81%aeunpack/&via=dataich&text=PHPでのunpack&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2008/04/25/php_e3_81_a7_e3_81_aeunpack/_via=dataich_text=PHP_unpack_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2008/04/25/php%e3%81%a7%e3%81%aeunpack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smartyを携帯向けに</title>
		<link>http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/</link>
		<comments>http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/#comments</comments>
		<pubDate>Sun, 22 Jul 2007 03:20:00 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Smarty]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/</guid>
		<description><![CDATA[Smartyを携帯に対応させようとすると、どうしてもSJISの問題が発生する。 「{」「}」がSJISのコードに含まれるため、テンプレートはSJISでは書けない。 そこで、Smartyのoutputfilterを使用した [...]]]></description>
			<content:encoded><![CDATA[<p>Smartyを携帯に対応させようとすると、どうしてもSJISの問題が発生する。<br />
「{」「}」がSJISのコードに含まれるため、テンプレートはSJISでは書けない。<br />
そこで、Smartyの<a class="wpGallery" href="http://smarty.php.net/manual/ja/advanced.features.outputfilters.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/smarty.php.net/manual/ja/advanced.features.outputfilters.php?referer=');">outputfilter</a>を使用した。</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="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// 画面出力時に、テンプレートをUTF-8からSJISに変換する。</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000000; font-weight: bold;">function</span> filterUTF8ToSJIS<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buff</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$smarty</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">mb_convert_encoding</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buff</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;SJIS&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$smarty</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smarty<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                              <span style="color: #666666; font-style: italic;">//Smartyオブジェクト生成</span>
<span style="color: #000088;">$smarty</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register_outputfilter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;filterUTF8ToSJIS&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//フィルターの登録</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;default_charset&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Shift_JIS&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>            <span style="color: #666666; font-style: italic;">//PHPの設定default_charsetにSJISを設定</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/&via=dataich&text=Smartyを携帯向けに&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2007/07/22/smarty_e3_82_92_e6_90_ba_e5_b8_af_e5_90_91_e3_81_91_e3_81_ab/_via=dataich_text=Smarty_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2007/07/22/smarty%e3%82%92%e6%90%ba%e5%b8%af%e5%90%91%e3%81%91%e3%81%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PDTインストール</title>
		<link>http://blog.dataich.com/2007/07/21/pdt%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/</link>
		<comments>http://blog.dataich.com/2007/07/21/pdt%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/#comments</comments>
		<pubDate>Sat, 21 Jul 2007 03:19:00 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2007/07/21/pdt%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/</guid>
		<description><![CDATA[EclipseのPHP開発環境であるPDT（PHP Development Tools）を導入してみた。 私は基本的に言語によってEclipseを分けているのでpluginではなく、all-in-oneでインストールした [...]]]></description>
			<content:encoded><![CDATA[<p>EclipseのPHP開発環境であるPDT（PHP Development Tools）を導入してみた。<br />
私は基本的に言語によってEclipseを分けているのでpluginではなく、all-in-oneでインストールした。<br />
手順は下記の通り。</p>
<h3>PDTインストール</h3>
<ol>
<li><a class="wpGallery" href="http://www.eclipse.org/pdt/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.eclipse.org/pdt/?referer=');">http://www.eclipse.org/pdt/</a>＞Downloads＞S20070611-M1＞pdt-all-in-one-S20070611_M1-win32.zip（2007/07/20現在）</li>
<li>任意のディレクトリ（ここではL:\PHPeclipse）に解凍</li>
</ol>
<h3>PDT日本語化</h3>
<ol>
<li><a class="wpGallery" href="http://mergedoc.sourceforge.jp" target="_blank" onclick="pageTracker._trackPageview('/outgoing/mergedoc.sourceforge.jp?referer=');">http://mergedoc.sourceforge.jp</a>/＞1.2.0より、pleiades_1.2.0.zipをダウンロード</li>
<li>ダウンロードしたpleiades_1.2.0.zipを解凍し、L:\PHPeclipseに上書き</li>
<li>eclipse.iniの最終行に下記を追加-javaagent:plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar</li>
<li>eclipseを起動し、日本語化されていることを確認</li>
</ol>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2007/07/21/pdt%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/&via=dataich&text=PDTインストール&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2007/07/21/pdt_e3_82_a4_e3_83_b3_e3_82_b9_e3_83_88_e3_83_bc_e3_83_ab/_via=dataich_text=PDT_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2007/07/21/pdt%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

