<?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>FireFore &#187; PHP</title>
	<atom:link href="http://firefore.com/bq/php/feed" rel="self" type="application/rss+xml" />
	<link>http://firefore.com</link>
	<description>不积硅步无以至千里</description>
	<lastBuildDate>Mon, 14 May 2012 04:44:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Shaking form</title>
		<link>http://firefore.com/2010/11/shaking-form.html</link>
		<comments>http://firefore.com/2010/11/shaking-form.html#comments</comments>
		<pubDate>Sun, 21 Nov 2010 15:07:37 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://firefore.com/?p=1306</guid>
		<description><![CDATA[前几天登入Wordpress后台，输错了账号密码，发现其整个表单会左右晃动，好比是人在摇头，感觉特别有意思。于是看了一下该页的源代码，剥离出其摇动的代码来，全浏览器兼容呢，贴在这里... ]]></description>
			<content:encoded><![CDATA[<p>前几天登入Wordpress后台，输错了账号密码，发现其整个表单会左右晃动，好比是人在摇头，感觉特别有意思。于是看了一下该页的源代码，剥离出其摇动的代码来，全浏览器兼容呢，贴在这里分享了。</p>
<p><span id="more-1306"></span>
<p>本人不懂编程也不懂代码，所以只能做原始的剥离了。哈哈哈。</p>
<p><a  href="http://firefore.com/doc/shake.html" target="_blank">例子可以点这里看DIV晃动演示页</a></p>
<p>首先，在页面的&lt;head&gt;&lt;/head&gt;中插入下面的JS代码：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
addLoadEvent <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>func<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> jQuery<span style="color: #339933;">!=</span><span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span>jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span>func<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>else <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> wpOnload<span style="color: #339933;">!=</span><span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>wpOnload<span style="color: #339933;">=</span>func<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span><span style="color: #003366; font-weight: bold;">var</span> oldonload<span style="color: #339933;">=</span>wpOnload<span style="color: #339933;">;</span>wpOnload<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>oldonload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>func<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> s<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>pos<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>g<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">left</span><span style="color: #339933;">=</span>pos<span style="color: #339933;">+</span><span style="color: #3366CC;">'px'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> g<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> shake<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>a<span style="color: #339933;">,</span>d<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>c<span style="color: #339933;">=</span>a.<span style="color: #660066;">shift</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>s<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>if<span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">length</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>setTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>shake<span style="color: #009900;">&#40;</span>id<span style="color: #339933;">,</span>a<span style="color: #339933;">,</span>d<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>d<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>g<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">position</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'static'</span><span style="color: #339933;">;</span>wp_attempt_focus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
addLoadEvent<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #003366; font-weight: bold;">var</span> p<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">15</span><span style="color: #339933;">,</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span><span style="color: #CC0000;">15</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,-</span><span style="color: #CC0000;">15</span><span style="color: #339933;">,-</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,-</span><span style="color: #CC0000;">15</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>p<span style="color: #339933;">=</span>p.<span style="color: #660066;">concat</span><span style="color: #009900;">&#40;</span>p.<span style="color: #660066;">concat</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>var i<span style="color: #339933;">=</span>document.<span style="color: #660066;">forms</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">id</span><span style="color: #339933;">;</span>g<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">position</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'relative'</span><span style="color: #339933;">;</span>shake<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span>p<span style="color: #339933;">,</span><span style="color: #CC0000;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>其次，在页面底部的&lt;/body&gt;之前插入第二段JS代码：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">function</span> wp_attempt_focus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
setTimeout<span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>
d <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'loginform'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
d.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
d.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> wpOnload<span style="color: #339933;">==</span><span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span>wpOnload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>请注意要晃动的那个form中一定要加上ID哦。</p>
<p><a  href="http://firefore.com/doc/shake.html.txt" target="_blank">点这里可以看到例子页面的源代码</a></p>
<p>然后现在页面一旦载入，form的内容就会左右摇晃。哈哈。</p>
<p>如果想实现Wordpress那种输入错误才会摇晃的表现方式，则可以查看Wordpress目录下wp-login.php文件，其用<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/php" title="查看 PHP 中的全部文章" target="_blank">PHP</a></span>代码做了个判断。</p>
<hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2010/11/shaking-form.html/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>ubuntu9.10下的eAccelerator</title>
		<link>http://firefore.com/2010/01/ubuntu9-10-eaccelerator.html</link>
		<comments>http://firefore.com/2010/01/ubuntu9-10-eaccelerator.html#comments</comments>
		<pubDate>Thu, 14 Jan 2010 04:28:19 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[心情杂记]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://firefore.com/?p=880</guid>
		<description><![CDATA[把ubuntu升级到9.10之后，突然发现apache2不监听80端口了。 查看了/var/log/apache2/里面的error.log日志，发现有一条记录: PHP Warning: &#91;eAccelerator&#93; This build of &#34;eAccelerator&#34; was compiled for PHP version 5.... ]]></description>
			<content:encoded><![CDATA[<p>把<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/ubuntu" title="查看 ubuntu 中的全部文章" target="_blank">ubuntu</a></span>升级到9.10之后，突然发现apache2不监听80端口了。</p>
<p>查看了/var/log/apache2/里面的error.log日志，发现有一条记录:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">PHP Warning:  <span style="color: #7a0874; font-weight: bold;">&#91;</span>eAccelerator<span style="color: #7a0874; font-weight: bold;">&#93;</span> This build of <span style="color: #ff0000;">&quot;eAccelerator&quot;</span> was compiled <span style="color: #000000; font-weight: bold;">for</span> PHP version 5.2.10-2ubuntu6.3. Rebuild it <span style="color: #000000; font-weight: bold;">for</span> your PHP version <span style="color: #7a0874; font-weight: bold;">&#40;</span>5.2.10-2ubuntu6.4<span style="color: #7a0874; font-weight: bold;">&#41;</span> or download precompiled binaries.\n <span style="color: #000000; font-weight: bold;">in</span> Unknown on line <span style="color: #000000;">0</span>
PHP Fatal error:  Unable to start eAccelerator module <span style="color: #000000; font-weight: bold;">in</span> Unknown on line <span style="color: #000000;">0</span></pre></div></div>

<p>那就干脆升级一下<a  href="http://www.eaccelerator.net" target="_blank">eAccelerator</a>吧。截止本文书写之日，eAccelerator最近的版本为 0.9.6-rc1 </p>
<p><span id="more-880"></span></p>
<p>下载eAccelerator-0.9.6-rc1：<a  href="http://www.eaccelerator.net/wiki/Release-0.9.6-rc1" target="_blank">http://www.eaccelerator.net/wiki/Release-0.9.6-rc1</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>bart.eaccelerator.net<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>0.9.6<span style="color: #000000; font-weight: bold;">/</span>eaccelerator-0.9.6-rc1.tar.bz2</pre></div></div>

<p>解压缩eAccelerator:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> jxvf eaccelerator-0.9.6-rc1.tar.bz2</pre></div></div>

<p>进入eAccletator的目录：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> eaccelerator-0.9.6-rc1<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>运行如下几个指令（一行一个指令，等执行完了再输入下一个）：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">phpize 
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-eaccelerator</span>=shared
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> 
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<pre>安装好之后，屏幕会显示大概如下信息：</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Installing shared extensions:     <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20060613</span>+lfs<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p><strong>修改php.ini和建立并设置/var/cache/<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/eaccelerator" title="查看 eaccelerator 中的全部文章" target="_blank">eaccelerator</a></span>目录的权限。具体的请看之前的文章：<br />
    <br /></strong><a  href="http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html" target="_blank">http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html</a><strong></strong></p>
<p>最后步骤：升级control.php文件</p>
<p><span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/eaccelerator" title="查看 eaccelerator 中的全部文章" target="_blank">eaccelerator</a></span>-0.9.6-rc1的control.php和我们之前介绍的eaccelerator-0.9.5.3的control.php文件内容已经不同。所以无法继续使用旧版本的control.php文件。</p>
<p>所以，我们先复制新版本的control.php去覆盖掉旧版本的：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> control.php <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>control.php</pre></div></div>

<p>新版本的control.php默认是无需账号密码即可查看。所以我们对control.php做如下修改：<br />
  <br />先用vi指令编辑control.php:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>control.php</pre></div></div>

<p>大概19-23行的内容如下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/***</span> CONFIG <span style="color: #000000; font-weight: bold;">***/</span>
<span style="color: #007800;">$auth</span> = <span style="color: #c20cb9; font-weight: bold;">false</span>;          <span style="color: #000000; font-weight: bold;">//</span> Set to <span style="color: #c20cb9; font-weight: bold;">false</span> to disable authentication
<span style="color: #007800;">$user</span> = <span style="color: #ff0000;">&quot;admin&quot;</span>;
<span style="color: #007800;">$pw</span> = <span style="color: #ff0000;">&quot;eAccelerator&quot;</span>;</pre></div></div>

<p>为了安全起见，我们把这些修改为：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/***</span> CONFIG <span style="color: #000000; font-weight: bold;">***/</span>
<span style="color: #007800;">$auth</span> = <span style="color: #c20cb9; font-weight: bold;">true</span>;          <span style="color: #000000; font-weight: bold;">//</span> Set to <span style="color: #c20cb9; font-weight: bold;">false</span> to disable authentication
<span style="color: #007800;">$user</span> = <span style="color: #ff0000;">&quot;管理账号&quot;</span>;
<span style="color: #007800;">$pw</span> = <span style="color: #ff0000;">&quot;管理密码&quot;</span>;</pre></div></div>

<p>然后保存退出，这样当有人访问control.php的时候，就需要输入管理账号和管理密码了。</p>
<p>然后，老习惯，检查一下apache2的配置和重新一下apache2:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">apache2ctl configtest
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>如果没看到错误信息，基本大功告成了。</p>
<p>本日志作为：<a  href="http://firefore.com" target="_blank">施炜煜</a> </p>
<p>原文地址：<a  href="http://firefore.com/2010/01/ubuntu9-10-eaccelerator.html">http://firefore.com/2010/01/ubuntu9-10-eaccelerator.html</a></p>
<hr /><h4>相关文章：</h4><ul><li><a  href="http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html" rel="bookmark" title="Permanent Link: ubuntu安装eAccelerator">ubuntu安装eAccelerator</a></li></ul><hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2010/01/ubuntu9-10-eaccelerator.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ubuntu安装eAccelerator</title>
		<link>http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html</link>
		<comments>http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html#comments</comments>
		<pubDate>Fri, 11 Sep 2009 15:57:30 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html</guid>
		<description><![CDATA[今天给一台Ubuntu的机器安装了eAccelerator的扩展。写个小笔记如下： 首先，得安装一下php5-dev： sudo apt-get install php5-dev 下载eAccelerator：（具体下载地址可以访问官网，版本不同，地址也不同） wge... ]]></description>
			<content:encoded><![CDATA[<p>今天给一台Ubuntu的机器安装了eAccelerator的扩展。写个小笔记如下：</p>
<p>首先，得安装一下php5-dev：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-dev</pre></div></div>

<p>下载eAccelerator：（具体下载地址可以访问官网，版本不同，地址也不同）</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>bart.eaccelerator.net<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>0.9.5.3<span style="color: #000000; font-weight: bold;">/</span>eaccelerator-0.9.5.3.tar.bz2</pre></div></div>

<p><span id="more-756"></span></p>
<p>解压缩eAccelerator：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> jxvf eaccelerator-0.9.5.3.tar.bz2</pre></div></div>

<p>进入eAccelerator的目录：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> eaccelerator-0.9.5.3<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>运行如下几个指令（一行一个指令，等执行完了再输入下一个）：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">phpize 
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-eaccelerator</span>=shared
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> 
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>安装好之后，屏幕会显示大概如下信息：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Installing shared extensions:     <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20060613</span>+lfs<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>接着修改php.ini：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php5<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></div></div>

<p>在文档最后加上：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">zend_extension<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/usr/lib/php5/20060613+lfs/eaccelerator.so&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>shm_size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;16&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>cache_dir<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/var/cache/eaccelerator&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>enable<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>optimizer<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>check_mtime<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>debug<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>filter<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>shm_max<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>shm_ttl<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>shm_prune_period<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>shm_only<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>compress<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>compress_level<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;9&quot;</span> 
eaccelerator<span style="color: #339933;">.</span>allowed_admin_path<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/var/www/control.php&quot;</span></pre></div></div>

<p>这里解释一下，最后一行的<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/eaccelerator" title="查看 eaccelerator 中的全部文章" target="_blank">eaccelerator</a></span>.allowed_admin_path的意思是eAccelerator的在线控制文件的实际路径，这样一来就可以使用http://你的网址/control.php来控制eAccelerator了。</p>
<p>接下来建立cache目录（一行一个指令）：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root:www-data <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #007800;">u</span>=rwx,<span style="color: #007800;">g</span>=rwx,<span style="color: #007800;">o</span>= <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>eaccelerator</pre></div></div>

<p>然后进入<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/eaccelerator" title="查看 eaccelerator 中的全部文章" target="_blank">eaccelerator</a></span>-0.9.5.3的目录里拷贝control.php到网站目录：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> control.php <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www</pre></div></div>

<p>接着修改control.php里的$user和$pw的内容：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>control.php</pre></div></div>

<p>因为当你用http://你的网址/control.php访问的时候，是需要输入账号密码的。$user是账号，$pw是密码。</p>
<p>最后用指令检查一下apache2的配置：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">apache2ctl configtest</pre></div></div>

<p>没有错误出现后重新启动apache：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>如此就大功告成了。</p>
<p>在phpinfo()里面应该就可以看到有如下：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">This program makes use of the Zend Scripting Language Engine: 
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies 
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator</pre></div></div>

<p>参考网站：<a  title="http://eaccelerator.net/wiki/InstallFromSource" href="http://eaccelerator.net/wiki/InstallFromSource" target="_blank">http://eaccelerator.net/wiki/InstallFromSource</a></p>
<p>本日志作者：<a  href="http://firefore.com" target="_blank">施炜煜</a></p>
<p>原文地址：<a  href="http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html" target="_blank">http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html</a></p>
<hr /><h4>相关文章：</h4><ul><li><a  href="http://firefore.com/2010/01/ubuntu9-10-eaccelerator.html" rel="bookmark" title="Permanent Link: ubuntu9.10下的eAccelerator">ubuntu9.10下的eAccelerator</a></li><li><a  href="http://firefore.com/2007/12/onlinegame-server-requirement.html" rel="bookmark" title="Permanent Link: 浅谈我接触过的网络游戏的服务器需求">浅谈我接触过的网络游戏的服务器需求</a></li><li><a  href="http://firefore.com/2007/11/sql-server-2000-version.html" rel="bookmark" title="Permanent Link: 怎么查看SQL SERVER 2000是否打过SP4的补丁">怎么查看SQL SERVER 2000是否打过SP4的补丁</a></li></ul><hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2009/09/installing-eaccelerator-in-ubuntu-server.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>以背景色区分Blog作者评论与普通评论</title>
		<link>http://firefore.com/2009/04/author-comments-bg.html</link>
		<comments>http://firefore.com/2009/04/author-comments-bg.html#comments</comments>
		<pubDate>Tue, 14 Apr 2009 07:50:48 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PureCSS]]></category>

		<guid isPermaLink="false">http://firefore.com/2009/04/author-comments-bg.html</guid>
		<description><![CDATA[这里指的是在WordPress中，判断是否Blog作者，并且在评论内容调用不同的CSS来实现Blog作者评论跟普通评论的区分。实现方法很简单，网上也有很多实现方法。自从使用了PureCSS这个主题后，炜煜... ]]></description>
			<content:encoded><![CDATA[<p>这里指的是在<a  href="http://wordpress.org/" target="_blank">WordPress</a>中，判断是否Blog作者，并且在评论内容调用不同的CSS来实现Blog作者评论跟普通评论的区分。实现方法很简单，网上也有很多实现方法。自从使用了<a  href="http://fairyfish.net/2008/08/13/purecss-theme/">PureCSS</a>这个主题后，炜煜<a  href="http://firefore.com/2009/03/purecss-theme.html" target="_blank">或多或少对主题的摆弄有点了点兴趣</a>。所以下面我继续用我这个修改过的主题来举例说明。</p>
<p><span id="more-538"></span>
<p>根据文章开头的意思，其实就是自定评论样式的一种。会修改到2个文件，1个是functions.php 。一个是style.css 。判断是否为Blog作者并且使用不同样式的主要代码如下：    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000088;">$isByAuthor</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_id</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$isByAuthor</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$isByAuthor</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'commentcontent-author'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span>
	<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'commentcontent'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>解释：<strong>commentcontent-author</strong>和<strong>commentcontent</strong>就是2个不同的样式。当判断为Blog作者时，调用了commentcontent-author这个样式。我把这个判断放到了自定义 Comments 列表函数里面。接着把需要变色的那个div的样式修改为</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">class=&quot;<span style="color: #009900;">&lt;?php _e<span style="color: #66cc66;">&#40;</span>$oddcomment<span style="color: #66cc66;">&#41;</span>; ?&gt;</span>&quot;</pre></div></div>

<p>这样functions.php就修改好了。这样，我的整个自定义评论的函数如下：     </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> custom_comments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #000088;">$depth</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$commentcount</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$commentcount</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$commentcount</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$commentcount</span> <span style="color: #339933;">++;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$commentalt</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#40;</span><span style="color: #000088;">$commentalt</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;alt&quot;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$commentalt</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">:</span><span style="color: #000088;">$commentalt</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;alt&quot;</span><span style="color: #339933;">;</span>   
<span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span>
			<span style="color: #000088;">$isByAuthor</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_id</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$isByAuthor</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$isByAuthor</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'commentcontent-author'</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'commentcontent'</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;li <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
&nbsp;
    &lt;div class=&quot;commentmetadata <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$commentalt</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;strong&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$commentcount</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>.&lt;/strong&gt; &lt;cite&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_author_link<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/cite&gt; | &lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_date<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> at <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> | &lt;a href=&quot;#comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;#&lt;/a&gt;&lt;/small&gt;&lt;/div&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">32</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;div class=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #000088;">$oddcomment</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_text<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_comment_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Edit Comment'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;span class=&quot;editlink&quot;&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span><span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'reply_text'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;回复该留言&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

</p>
<p>style.css中，我增加了commentcontent-author这个样式。其实就是拷贝一次commentcontent，然后修改为commentcontent-author，另外加上背景颜色或是背景图片的样式即可。我这里的内容如下：    </p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.commentcontent-author<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#bfbfbf</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#f2f7f8</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</p>
<p>这里的实现方法是参考了<a  href="http://dupola.com" target="_blank">dupola</a>的主题：<a  href="http://dupola.com/wordpress/twitter" target="_blank">Twitter Theme</a>。     <br />另外，推荐<a  href="http://jobru.net" target="_blank">乔布鲁</a>的这篇文章：<a  href="http://jobru.net/how-to-highlight-comments-bg/" target="_blank">如何高亮你的评论背景色</a>。有举例说明哦。而且我这里使用的其实就是该篇文章介绍的方法一。</p>
<hr /><h4>相关文章：</h4><ul><li><a  href="http://firefore.com/2008/04/ie6-comments.html" rel="bookmark" title="Permanent Link: 快让我抓狂的IE6或是我的评论页面。">快让我抓狂的IE6或是我的评论页面。</a></li><li><a  href="http://firefore.com/2008/07/i-need-help.html" rel="bookmark" title="Permanent Link: 寻求帮助">寻求帮助</a></li><li><a  href="http://firefore.com/2008/04/deep-blue-theme-ie6-comments-bug.html" rel="bookmark" title="Permanent Link: Deep Blue Theme在IE6下评论偏移的BUG修复">Deep Blue Theme在IE6下评论偏移的BUG修复</a></li></ul><hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2009/04/author-comments-bg.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>用Google的自定义搜索引擎替代站内的搜索</title>
		<link>http://firefore.com/2008/03/google-cse.html</link>
		<comments>http://firefore.com/2008/03/google-cse.html#comments</comments>
		<pubDate>Tue, 25 Mar 2008 06:09:59 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[资源共享]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://firefore.com/2008/03/google-cse.html</guid>
		<description><![CDATA[很早以前就发现WordPress自带的搜索功能很不好用。所以用了Google的自定义搜索引擎替代站内的搜索。本来想用Google AJAX Search API的，但是太复杂了。后来就决定使用Google自定义搜索引擎了！ 要使... ]]></description>
			<content:encoded><![CDATA[<p style="text-indent:2em">很早以前就发现<a  title="WordPress官方站点" href="http://wordpress.org" target="_blank">WordPress</a>自带的搜索功能很不好用。所以用了<a  href="http://www.google.com" target="_blank">Google</a>的<strong>自定义搜索引擎</strong>替代站内的搜索。本来想用<a  href="http://code.google.com/intl/zh-CN/apis/ajaxsearch/" target="_blank">Google AJAX Search API</a>的，但是太复杂了。后来就决定使用<a  href="http://www.google.com/coop/cse/?hl=zh-CN" target="_blank">Google自定义搜索引擎</a>了！</p>
<p style="text-indent:2em">要使用<a  href="http://www.google.com/coop/cse/?hl=zh-CN" target="_blank">Google自定义搜索引擎</a>。首先得有个<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/google" title="查看 Google 中的全部文章" target="_blank">Google</a></span>的账户。<a  href="https://www.google.com/accounts/NewAccount?continue=http%3A%2F%2Fwww.google.com%2Fcoop%2Fmanage%2Fcse%2Fcreate%2F1%3Fhl%3Dzh-CN&#038;service=cprose&#038;hl=zh-CN" target="_blank">点这里:<b>创建 <span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/google" title="查看 Google 中的全部文章" target="_blank">Google</a></span> 帐户</b></a>。然后访问<a  href="http://www.google.com/coop/cse/?hl=zh-CN" target="_blank">Google自定义搜索引擎</a>。再点&#8220;<a  href="http://www.google.com/coop/manage/cse/create/1?hl=zh-CN" target="_blank">创建自定义搜索引擎</a>&#8221;，输入相关信息之后，就可以开始使用了。</p>
<p style="text-indent:2em">首先在自定义搜索引擎的控制面板上，先制定搜索的网站是自己的网站，然后获取到代码，在代码页面的<strong>搜索结果托管选项</strong>中，我选择的是&#8220;一个网页提供搜索框，另一个提供结果&#8221;的形式。然后在页面的下面有个<strong>搜索结果代码</strong>的文本框，把文本框内的代码拷贝下来，然后在<a  title="WordPress官方站点" href="http://wordpress.org" target="_blank">WordPress</a>使用的主题目录下，拷贝一个<strong>page.php</strong>的副本，重命名一下。我这里是重命名为<strong>googlesearch.php</strong>。然后用编辑器打开googlesearch.php（这里我个人推荐使用<a  href="http://notepad-plus.sourceforge.net/" target="_blank">Notepad++</a>!），在其顶部代码</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>之前添加以下代码：</p>

<div class="wp_syntax"><div 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;">/*
Template Name: googlesearch
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><em>此段代码的作用是把这个页面定义一个模板名称，以下会用到。</em></p>
<p style="text-indent:2em">然后把刚才我们从<a  href="http://www.google.com/coop/cse/?hl=zh-CN" target="_blank">Google的自定义搜索引擎</a>的控制面板上的<strong>搜索结果代码</strong>的文本框内的拷贝下来的代码，替换到</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;</span></pre></div></div>

<p>和</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>中间的那些内容。其他的地方不需要修改了。然后保存一下，记得一定要按照utf8格式保存。</p>
<p style="text-indent:2em">然后登录到<a  title="WordPress官方站点" href="http://wordpress.org" target="_blank">WordPress</a>的后台，撰写一个新页面，页面的标题由自己填写了。重要的两个地方，一个是页面模板必须选择googlesearch。页面缩略名一定要用英文（我这里也是用googlesearch）。保存之后。就可以用<u>http://您的站点/googlesearch</u>访问了。拷贝下这个地址。</p>
<p style="text-indent:2em">返回<a  href="http://www.google.com/coop/cse/?hl=zh-CN" target="_blank">google的自定义搜索引擎</a>的控制面板，在<strong>指定搜索结果详情</strong>下面的文本栏里把<u>http://您的站点/googlesearch</u>粘帖进去。至于那个广告位置，随意选择了。以上操作之后，可以看到<strong>搜索框代码</strong>的文本框内的代码有所变动（其实就是把我们制定的网址加入搜索框代码），然后我们拷贝这个搜索框代码。然后再到<a  title="WordPress官方站点" href="http://wordpress.org" target="_blank">WordPress</a>的中，修改主题，放置这段搜索框代码替换掉原来的站内搜索代码。这样就可以让<a  href="http://www.google.com" target="_blank">Google</a>的搜索来替代原始的搜索了，而且搜索结果显示在自己的网站上了。</p>
<p style="text-indent:2em">然后我自己是修改了搜索框代码的内容，主要是一些样式的修改，好适应我目前使用的主题。不知道会不会违反<a  href="http://www.google.com/coop/cse/?hl=zh-CN" target="_blank">Google自定义搜索引擎</a>的<a  href="http://www.google.com/coop/docs/cse/tos.html?hl=zh-CN" target="_blank">服务条款</a>。服务条款内全是英文，我的英文能力不好，只能看个大概，差不多是搜索的结果那边是不能动的，至于这个搜索框，好像没啥要求？？？</p>
<hr /><h4>相关文章：</h4><ul><li><a  href="http://firefore.com/2007/09/google9year.html" rel="bookmark" title="Permanent Link: Google 9年了。时间好快~">Google 9年了。时间好快~</a></li><li><a  href="http://firefore.com/2008/05/google-com-chinaearthquake.html" rel="bookmark" title="Permanent Link: Google-援助中国抗震救灾专题页">Google-援助中国抗震救灾专题页</a></li><li><a  href="http://firefore.com/2008/02/wuzi-1.html" rel="bookmark" title="Permanent Link: 初六，上班了。戊子年第一篇。">初六，上班了。戊子年第一篇。</a></li></ul><hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2008/03/google-cse.html/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>让PHP不再暴露目录路径&#8230;釜底抽薪招 &gt;.</title>
		<link>http://firefore.com/2007/12/php-display_errors-off.html</link>
		<comments>http://firefore.com/2007/12/php-display_errors-off.html#comments</comments>
		<pubDate>Fri, 14 Dec 2007 02:07:54 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://firefore.com/2007/12/php-display_errors-off.html</guid>
		<description><![CDATA[方法就是：关闭掉PHP的错误信息提示。 打开PHP.ini后。 搜索到 display_errors = On(默认是开启状态) 我们修改为 display_errors = Off 这样就关闭了错误信息的提示了。 但是这样一来，有什么错误我们也... ]]></description>
			<content:encoded><![CDATA[<p>方法就是：关闭掉<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/php" title="查看 PHP 中的全部文章" target="_blank">PHP</a></span>的错误信息提示。<br />
打开<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/php" title="查看 PHP 中的全部文章" target="_blank">PHP</a></span>.ini后。<br />
搜索到<br />
<coolcode linenum="off">display_errors = On</coolcode>(默认是开启状态)<br />
我们修改为<br />
<coolcode linenum="off">display_errors = Off</coolcode><br />
这样就关闭了错误信息的提示了。</p>
<p>但是这样一来，有什么错误我们也不知道呀。所以，我们需要起用错误日志功能。<br />
继续搜索<span id="more-105"></span><br />
<coolcode linenum="off">log_errors = Off</coolcode>(次状态是未开启错误日志功能，如果您搜索到的是 log_errors = On 那就可以跳过这步骤了。)<br />
然后修改为<br />
<coolcode linenum="off">log_errors = On</coolcode></p>
<p>接下来就是设置日志的存放地方。<br />
搜索<br />
<coolcode linenum="off">error_log =</coolcode><br />
后可以看到类似下面的<br />
<coolcode linenum="off">;error_log = “XXXXXX”</coolcode>（XXXXX修改为日志的存放目录就行了。但是千万记得要有写入的权限。）<br />
前面的;记得要去掉哦。这个符号去掉了就启用了的意思。</p>
<p>哦，还有，修改保存之后要重新启动WEB服务才有效。</p>
<p><strong>修改PHP.ini我个人强烈推荐一个超级文本编辑器：<a  href="http://notepad-plus.sourceforge.net/" target="_blank">Notepad++</a> 看看准没错拉~~</strong></p>
<hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2007/12/php-display_errors-off.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>windows下apache_2.2.4配置支持php-5.2.3</title>
		<link>http://firefore.com/2007/09/apache-php-win-nocgi.html</link>
		<comments>http://firefore.com/2007/09/apache-php-win-nocgi.html#comments</comments>
		<pubDate>Sat, 29 Sep 2007 02:35:10 +0000</pubDate>
		<dc:creator>FireFore</dc:creator>
				<category><![CDATA[学习笔记]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://firefore.com/2007/09/apache-php-win-nocgi.html</guid>
		<description><![CDATA[windows下apache_2.2.4配置支持php-5.2.3，非CGI模式！ 首先分别从http://www.apache.org和http://www.php.net下载apache2.2.4和php5.2.3 然后APACHE正常安装。 PHP解压缩到任意位置。比如我们这里是d:/php 然后编辑apache... ]]></description>
			<content:encoded><![CDATA[<p>windows下apache_2.2.4配置支持php-5.2.3，非CGI模式！<br />
首先分别从http://www.apache.org和http://www.php.net下载apache2.2.4和php5.2.3</p>
<p>然后APACHE正常安装。</p>
<p><span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/php" title="查看 PHP 中的全部文章" target="_blank">PHP</a></span>解压缩到任意位置。比如我们这里是d:/php</p>
<p>然后编辑apache安装目录下的子目录conf里面的httpd.conf</p>
<p>添加以下信息</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">LoadModule</span> php5_module <span style="color: #7f007f;">&quot;D:/php/php5apache2_2.dll&quot;</span>
<span style="color: #00007f;">AddType</span> application/x-httpd-php .php
<span style="color: #00007f;">PHPIniDir</span> <span style="color: #7f007f;">&quot;D:/php&quot;</span></pre></div></div>

<p>解释一下哦。<br />
第一行，指定apache2.2.x去读取php5的那个dll文件。我本来是读取php5apache2.dll但是重新启动apache的时候一直报错，所以才想起来php目录下面还有一个php5apache2_2.dll<br />
第二行，就是大家都熟悉的给apache添加一个文件类型的解析<br />
第三行，以前的版本没有看到的哦。这个是指定php.ini的位置。以后就不用拷贝php.ini到WINDOWS目录下了。</p>
<p>顺便，<span class='wp_keywordlink_affiliate'><a href="http://firefore.com/bq/php" title="查看 PHP 中的全部文章" target="_blank">PHP</a></span>.ini在配置支持模块的时候有个地方要注意</p>
<p>就是extension_dir = 这个位置<br />
默认是</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">extension_dir <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;./&quot;</span></pre></div></div>

<p>很多时候，采用默认的这个方法都是无法正常获得ext目录的所在的。所以这里我们修改为：</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">extension_dir = <span style="color: #7f007f;">&quot;D:/php/ext&quot;</span></pre></div></div>

<p>这样。就不会找不到ext的目录而产生错误了。</p>
<hr /><small><p>&#26412;&#20316;&#21697;&#30001;<a  0="xmlns:cc="http://creativecommons.org/ns#"" href="http://firefore.com" property="cc:attributionName" rel="cc:attributionURL">shiweiyu</a>&#21019;&#20316;&#65292;&#37319;&#29992;<a  rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">&#30693;&#35782;&#20849;&#20139;&#32626;&#21517;-&#30456;&#21516;&#26041;&#24335;&#20849;&#20139; 3.0 Unported&#35768;&#21487;&#21327;&#35758;</a>&#36827;&#34892;&#35768;&#21487;&#12290;<br />
Copyright &copy; 2010 <a  href="http://firefore.com">FireFore.com</a> (数字指纹： woaiwojia_weiyu (38.107.179.214) )</small></p>]]></content:encoded>
			<wfw:commentRss>http://firefore.com/2007/09/apache-php-win-nocgi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

