<?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; Apache</title>
	<atom:link href="http://blog.dataich.com/tag/apache/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>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>Failed to release SSL session cache lock</title>
		<link>http://blog.dataich.com/2008/07/29/failed-to-release-ssl-session-cache-lock/</link>
		<comments>http://blog.dataich.com/2008/07/29/failed-to-release-ssl-session-cache-lock/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 03:54:22 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2008/07/29/failed-to-release-ssl-session-cache-lock/</guid>
		<description><![CDATA[/var/log/httpd/ssl_error.logを見ると下記エラーが多発していた。 &#91;warn&#93; &#40;13&#41;Permission denied: Failed to release  [...]]]></description>
			<content:encoded><![CDATA[<p>/var/log/httpd/ssl_error.logを見ると下記エラーが多発していた。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>warn<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">13</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>Permission denied: Failed to release SSL session cache lock
<span style="color: #7a0874; font-weight: bold;">&#91;</span>warn<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">13</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>Permission denied: Failed to acquire SSL session cache lock</pre></div></div>

<p>/etc/httpd/conf/httpd.confを見てみるとApacheの実行ユーザがnobodyになっているのに対し、sslのキャッシュディレクトリである/var/cache/mod_sslの所有者がデフォルトのapache:rootのままだった、、、。<br />
こいつを nobody:rootに変えてやって、Apache再起動で解決。</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2008/07/29/failed-to-release-ssl-session-cache-lock/&via=dataich&text=Failed to release SSL session cache lock&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2008/07/29/failed-to-release-ssl-session-cache-lock/_via=dataich_text=Failed_to_release_SSL_session_cache_lock_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/07/29/failed-to-release-ssl-session-cache-lock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

