<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>阅微堂 &#187; Dreamhost</title>
	<atom:link href="http://zhiqiang.org/blog/tag/dreamhost/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>数学、金融、计算机</description>
	<lastBuildDate>Wed, 23 May 2012 08:37:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>blog服务器搬家到bluehost</title>
		<link>http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html</link>
		<comments>http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html#comments</comments>
		<pubDate>Wed, 25 Apr 2007 12:21:13 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[记事本]]></category>
		<category><![CDATA[bluehost]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[搬家]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/576.html</guid>
		<description><![CDATA[博客 » IT技术 » bluehost，Dreamhost，搬家 » 去年5月份买的Dreamhost快要到期了，趁cosβ组织Bluehost分享的机会，提前搬到了bluehost。 bluehost和dreamhost是中国独立blog用得最多的两个主机空间，而bluehost比dreamhost的口碑要稍微好一些。 用探针（同一个主机上的）看了一下，dreamhost的内存余量偏少，不过系统负载要小一些（比较dreamhost的load average）。探针看不到CPU数量，不过听说是四颗C...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href="http://zhiqiang.org/blog/tag/bluehost" rel="tag">bluehost</a>，<a href="http://zhiqiang.org/blog/tag/dreamhost" rel="tag">Dreamhost</a>，<a href="http://zhiqiang.org/blog/tag/%e6%90%ac%e5%ae%b6" rel="tag">搬家</a> » </p><p>去年<a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">5月份买的Dreamhost</a>快要到期了，趁cosβ组织Bluehost分享的机会，提前搬到了<a href="http://www.bluehost.com" target="_blank">bluehost</a>。</p>
<p>bluehost和<a href="http://dreamhost.com/" target="_blank">dreamhost</a>是中国独立blog用得最多的两个主机空间，而bluehost比dreamhost的口碑要稍微好一些。</p>
<p>用<a href="http://www.bluehostcn.com/hostinfo/" target="_blank">探针（同一个主机上的）</a>看了一下，dreamhost的内存余量偏少，不过系统负载要小一些（比较<a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">dreamhost的load average</a>）。探针看不到CPU数量，不过听说是四颗CPU，而Dreamhost是两颗。但同时，他们的CPU都是双核的，所以真实的CPU数量是bluehost有2颗，而Dreamhost只有一颗。这样的话，Dreamhost的平均负载偏高（一般都有4到6）。</p>
<p>上次买Dreamhost用的是777的promotion code，只花了9.5$。这次与人共享主机，70￥。我想现在有些人还在国内空间上挣扎，只不过因为信息的不透明罢了。其实，网络上的共享计划很多，用Google搜索一下<a href="http://www.google.com.hk/search?q=dreamhost%7Cbluehost+%E5%85%B1%E4%BA%AB&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a" target="_blank">dreamhost|bluehost 共享</a>看看。</p>
<p>[tags]bluehost,dreamhost,搬家[/tags]</p>
<div><h4>相关文章</h4><ul><li class='currentpost'><a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html">blog服务器搬家到bluehost</a></li><li ><a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">Dreamhost系统Load average负载记录和分析</a></li><li ><a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">搞定乱码，WordPress搬家到dreamhost</a></li><li ><a href="http://zhiqiang.org/blog/science/computer-science/move-blogbus-data-to-wordpress.html">BlogBus搬家文件转WordPress导入文件</a></li><li ><a href="http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html">Dreamhost上的GZIP &#038; Cache</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2007. | <a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html#comments">21 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Dreamhost系统Load average负载记录和分析</title>
		<link>http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html</link>
		<comments>http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html#comments</comments>
		<pubDate>Thu, 19 Apr 2007 13:27:13 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[bluehost]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[系统负载， average load]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/568.html</guid>
		<description><![CDATA[博客 » IT技术 » bluehost，Dreamhost，系统负载， average load » Dreamhost的空间马上就要到期了，面临着继续留在Dreamhost还是搬去Bluehost的选择。对我来说，主机速度是决定性因素。这几天用crontab把我的Dreamhost空间所在服务器的系统负载数据记录了一下，所用方法是新添一个cron: SSH下输入命令 crontab -e, 添加一行 */5 * * * * uptime &#62;&#62; status uptime命令会输出当前服务器的一些状态（用to...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href="http://zhiqiang.org/blog/tag/bluehost" rel="tag">bluehost</a>，<a href="http://zhiqiang.org/blog/tag/dreamhost" rel="tag">Dreamhost</a>，<a href="http://zhiqiang.org/blog/tag/%e7%b3%bb%e7%bb%9f%e8%b4%9f%e8%bd%bd%ef%bc%8c-average-load" rel="tag">系统负载， average load</a> » </p><p><a href="http://dreamhost.com/" target="_blank">Dreamhost</a>的空间马上就要到期了，面临着继续留在Dreamhost还是搬去<a href="http://www.bluehost.com" target="_blank">Bluehost</a>的选择。对我来说，主机速度是决定性因素。这几天用crontab把我的Dreamhost空间所在服务器的系统负载数据记录了一下，所用方法是新添一个cron: SSH下输入命令 crontab -e, 添加一行</p>
<blockquote><p>*/5 * * * * uptime &gt;&gt; status</p>
</blockquote>
<p>uptime命令会输出当前服务器的一些状态（用top命令能查到更多），大致是下面这种东西：</p>
<blockquote><p>23:35:00 up 32 days, 5:21, 11 users, load average: 1.50, 2.76, 3.04</p>
<p>这个输出，load average后面分别是1分钟、5分钟、15分钟的负载情况。数据是每隔5秒钟检查一次活跃的进程数，然后根据这个数值算出来的。</p>
</blockquote>
<p>定期检查status文件，我收集了大约10来天的数据，每五分钟统计一次。我比较关心的是<a href="http://en.wikipedia.org/wiki/Load_average" target="_blank">load average</a>数据。load average的含义大致为</p>
<blockquote><p>在Linux系统中，uptime、w、top等命令都会有系统平均负载load average的输出，那么什么是系统平均负载呢？</p>
<p>系统平均负载被定义为在特定时间间隔内运行队列中的平均进程树。如果一个进程满足以下条件则其就会位于运行队列中：</p>
<ul>
<li>它没有在等待I/O操作的结果  </li>
<li>它没有主动进入等待状态(也就是没有调用'wait')  </li>
<li>没有被停止(例如：等待终止)</li>
</ul>
</blockquote>
<p>一般来说只要每个CPU的当前活动进程数不大于3那么系统的性能就是良好的，如果每个CPU的任务数大于5，那么就表示这台机器的性能有严重问题。</p>
<p>服务器上的探针显示我在Dreamhost上的服务器有两颗CPU。下面是一些统计数据。这一张是按照时间分段显示负载，在当地时间午后（服务器时间跟北京时间相差15个小时），服务器负载最高。</p>
<p align="center"><a title="average load by time" href="http://www.flickr.com/photos/51234757@N00/465023838/"><img alt="average load by time" src="http://farm1.static.flickr.com/212/465023838_757b59bd0a.jpg" border="0"/></a></p>
<p align="left">下面是负载分布。约83%的时间负载低于6（每颗CPU负载低于3），但也有3%的时间每颗CPU负载高于5（系统超负荷）。</p>
<p align="center"><a title="average load frequency" href="http://www.flickr.com/photos/51234757@N00/465023684/"><img alt="average load frequency" src="http://farm1.static.flickr.com/226/465023684_f999df181c.jpg" border="0"/></a></p>
<p>&nbsp;对于数据还可以做很多事情，有兴趣的可以自己<a href="http://sites.google.com/site/mathzqy/dreamhoststatus.zip" target="_blank">下载数据</a>进行分析。</p>
<p>[tags]Dreamhost, bluehost, 系统负载， average load[/tags]</p>
<div><h4>相关文章</h4><ul><li class='currentpost'><a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">Dreamhost系统Load average负载记录和分析</a></li><li ><a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html">blog服务器搬家到bluehost</a></li><li ><a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">搞定乱码，WordPress搬家到dreamhost</a></li><li ><a href="http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html">Dreamhost上的GZIP &#038; Cache</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2007. | <a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html#comments">6 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dreamhost上的GZIP &amp; Cache</title>
		<link>http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html</link>
		<comments>http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html#comments</comments>
		<pubDate>Sun, 01 Apr 2007 11:09:54 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[GZIP]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/553.html</guid>
		<description><![CDATA[博客 » IT技术 » Cache，css，Dreamhost，GZIP，javascript » 用WordPress的都知道，WordPress可以打开GZIP传输，压缩比率能达到60%到80%。下表是本blog首页在Web Page Analyzer上的测试报告，此页面上包括css, js所有东西加起来才14K。 QTY SIZE# TYPE URL 1 6999 HTML http://zhiqiang.org/blog/ 1 2593 SCRIPT http://zhiqiang.org/blog/.../comment.js.php 1 2302 SCRIPT http://zhiqiang.org/.../all.js.php 1 2048 CSS http://zhiqiang.org/.../style.css.php 1 43...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href="http://zhiqiang.org/blog/tag/cache" rel="tag">Cache</a>，<a href="http://zhiqiang.org/blog/tag/css" rel="tag">css</a>，<a href="http://zhiqiang.org/blog/tag/dreamhost" rel="tag">Dreamhost</a>，<a href="http://zhiqiang.org/blog/tag/gzip" rel="tag">GZIP</a>，<a href="http://zhiqiang.org/blog/tag/javascript" rel="tag">javascript</a> » </p><p>用WordPress的都知道，WordPress可以打开GZIP传输，压缩比率能达到60%到80%。下表是本<a href="http://zhiqiang.org/blog/">blog首页</a>在<a href="http://www.websiteoptimization.com/services/analyze/index.html" target="_blank">Web Page Analyzer</a>上的测试报告，此页面上包括css, js<strong>所有东西</strong>加起来才<strong>14K。</strong></p>
<p align="center">
<table class="t" border="1">
<tbody>
<tr>
<th>QTY</th>
<th>SIZE#</th>
<th>TYPE</th>
<th>URL</th>
</tr>
<tr>
<td nowrap>1 </td>
<td nowrap>6999 </td>
<td nowrap>HTML </td>
<td nowrap><a href="http://zhiqiang.org/blog/">http://zhiqiang.org/blog/</a> </td>
</tr>
<tr>
<td nowrap>1 </td>
<td nowrap>2593 </td>
<td nowrap>SCRIPT </td>
<td nowrap><a href="http://zhiqiang.org/blog/wp-content/plugins/ajaxcomment/comment.js.php">http://zhiqiang.org/blog/.../comment.js.php</a> </td>
</tr>
<tr>
<td nowrap>1 </td>
<td nowrap>2302 </td>
<td nowrap>SCRIPT </td>
<td nowrap><a href="http://zhiqiang.org/blog/jscript/all.js.php">http://zhiqiang.org/.../all.js.php</a> </td>
</tr>
<tr>
<td nowrap>1 </td>
<td nowrap>2048 </td>
<td nowrap>CSS </td>
<td nowrap><a href="http://zhiqiang.org/blog/wp-content/themes/phoenixblue2/style.css.php">http://zhiqiang.org/.../style.css.php</a> </td>
</tr>
<tr>
<td nowrap>1 </td>
<td nowrap>431 </td>
<td nowrap>IMG </td>
<td nowrap><a href="http://feeds.feedburner.com/%7Efc/zhiqiang?bg=99CCFF&#038;ampfg=444444&#038;ampanim=0">http://feeds.feedburner.com/~fc/zhiqiang</a> </td>
</tr>
<tr>
<td nowrap>5 ^ </td>
<td nowrap>14373* </td>
<td> </td>
<td>Total (^unique objects)</td>
</tr>
</tbody>
</table>
<p>Dreamhost还用的是Apache 1.3(Am I wrong？)，所以没有mod_deflate模块，而用的是mod_gzip模块，这个模块直接在磁盘上读写，效率比前者要低。不过有总比没有好，毕竟压缩比率很高。</p>
<p>但诡异的是，服务器默认对CSS和JS不作压缩。写信去问了dreamhost客服，也没有什么好方法。最后我采用的方法是用php给包一层：用style.css.php来代替style.css：</p>
<blockquote><pre><span style="color: #0000ff">&lt;?</span>php <span style="color: #008000"># this is the file style.css.php, who contains style.css</span>
<span style="color: #008000"># set the request file name</span>
$<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.file.php">file</a>="<span style="color: #8b0000">style.css</span>";

<span style="color: #008000"># Set Expires, cache the file on the browse</span>
<span style="color: #008000"># Delete it if you don't want it</span>
<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Expires:</span>".<a style="color: #ffa500" href="http://cn.php.net/gmdate">gmdate</a>("<span style="color: #8b0000">D, d M Y H:i:s</span>", <a style="color: #ffa500" href="http://cn.php.net/time">time</a>()+15360000)."<span style="color: #8b0000">GMT</span>");
<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Cache-Control: max-age=315360000</span>");

<span style="color: #008000"># set the last modified time</span>
$mtime = <a style="color: #ffa500" href="http://cn.php.net/filemtime">filemtime</a>($<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.file.php">file</a>);
$gmt_mtime = <a style="color: #ffa500" href="http://cn.php.net/gmdate">gmdate</a>('<span style="color: #8b0000">D, d M Y H:i:s</span>', $mtime) . '<span style="color: #8b0000"> GMT</span>';
<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Last-Modified:</span>" . $gmt_mtime);

<span style="color: #008000"># output a mediatype header</span>
$ext = <a style="color: #ffa500" href="http://cn.php.net/array_pop">array_pop</a>(<a style="color: #ffa500" href="http://cn.php.net/explode">explode</a>('<span style="color: #8b0000">.</span>', $<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.file.php">file</a>));
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.switch.php">switch</a> ($ext){
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.switch.php">case</a> '<span style="color: #8b0000">css</span>':
 <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Content-type: text/css</span>");
 <a style="color: #0000ff" href="http://cn.php.net/break">break</a>;
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.switch.php">case</a> '<span style="color: #8b0000">js</span>' :
 <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Content-type: text/javascript</span>");
 <a style="color: #0000ff" href="http://cn.php.net/break">break</a>;
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.switch.php">case</a> '<span style="color: #8b0000">gif</span>':
 <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Content-type: image/gif</span>");
 <a style="color: #0000ff" href="http://cn.php.net/break">break</a>;
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.switch.php">case</a> '<span style="color: #8b0000">jpg</span>':
 <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Content-type: image/jpeg</span>");
 <a style="color: #0000ff" href="http://cn.php.net/break">break</a>;
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.switch.php">case</a> '<span style="color: #8b0000">png</span>':
 <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Content-type: image/png</span>");
 <a style="color: #0000ff" href="http://cn.php.net/break">break</a>;
<a style="color: #0000ff" href="http://cn.php.net/manual-lookup.php?pattern=default&amp;lang=en&amp;scope=404quickref">default</a>:
 <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.header.php">header</a>("<span style="color: #8b0000">Content-type: text/plain</span>");
}

<span style="color: #008000"># GZIP the content</span>
<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.if.php">if</a>(<a style="color: #ffa500" href="http://cn.php.net/extension_loaded">extension_loaded</a>('<span style="color: #8b0000">zlib</span>')){<a style="color: #ffa500" href="http://cn.php.net/ob_start">ob_start</a>();<a style="color: #ffa500" href="http://cn.php.net/ob_start">ob_start</a>('<span style="color: #8b0000">ob_gzhandler</span>');}

<span style="color: #008000"># echo the file's contents</span>
<a style="color: #0000ff" href="http://cn.php.net/echo">echo</a> <a style="color: #ffa500" href="http://cn.php.net/implode">implode</a>('<span style="color: #8b0000"></span>', <a style="color: #ffa500" href="http://cn.php.net/manual/en/function.file.php">file</a>($<a style="color: #ffa500" href="http://cn.php.net/manual/en/function.file.php">file</a>));

<a style="color: #0000ff" href="http://cn.php.net/manual/en/control-structures.if.php">if</a>(<a style="color: #ffa500" href="http://cn.php.net/extension_loaded">extension_loaded</a>('<span style="color: #8b0000">zlib</span>')){
<a style="color: #ffa500" href="http://cn.php.net/ob_end_flush">ob_end_flush</a>();
<span style="color: #008000"># set header the content's length;</span>
<span style="color: #008000"># header("Content-Length: ".ob_get_length()); # (It doesn't work? )</span>
<a style="color: #ffa500" href="http://cn.php.net/ob_end_flush">ob_end_flush</a>();
}
<span style="color: #0000ff">?&gt;</span></pre>
</blockquote>
<p>上面代码不仅压缩代码，而且要求浏览器端Cache这个文件。甚至，可以把所有css文件都放到一个php文件里，只要在echo处加入多个文件即可。</p>
<p>下面是一些常用的测试网站：</p>
<ul>
<li><a href="http://www.gidnetwork.com/tools/gzip-test.php" target="_blank">GZIP Test</a>: 测试一个URL地址是否支持GZIP传输，以及压缩比率。
</li>
<li><a href="http://www.websiteoptimization.com/services/analyze/index.html" target="_blank">Web Page Analyzer</a>：网站页面速度报告
</li>
<li><a href="http://www.ircache.net/cgi-bin/cacheability.py" target="_blank">Cacheability Test</a>: 测试一个页面是否可Cache</li>
</ul>
<p>参考资料：</p>
<ul>
<li><a href="http://www.mnot.net/cache_docs/" target="_blank">Caching Tutorial</a>
</li>
<li><a href="http://blog.htmlor.com/2006/08/03/serving_javascript_fast_chinese/">flickr对javascript干的好事</a>
</li>
<li><a href="http://www.badpenguin.org/php-howto-control-page-caching" target="_blank">Working with cached pages</a></li>
</ul>
<div><h4>相关文章</h4><ul><li class='currentpost'><a href="http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html">Dreamhost上的GZIP &#038; Cache</a></li><li ><a href="http://zhiqiang.org/blog/it/innerhtml-2-cd-issue-dynamic-modification-table-function-of-js.html">innerHTML只读问题 &amp; 两个动态修改Table的js函数</a></li><li ><a href="http://zhiqiang.org/blog/it/speedup-blog-set-browser-cache.html">加速blog：设置浏览器缓存</a></li><li ><a href="http://zhiqiang.org/blog/it/speedup-website-with-css-sprites.html">用CSS Sprites让网站再加速</a></li><li ><a href="http://zhiqiang.org/blog/it/speedup-blog-gzip-javascript-css.html">加速blog：GZIP压缩传输你的文件</a></li><li ><a href="http://zhiqiang.org/blog/it/speedup-blog-about-javascript-css.html">加速blog：关于javascript(css)</a></li><li ><a href="http://zhiqiang.org/blog/it/using-htaccess-to-speed-blog.html">设置blog的缓存和压缩</a></li><li ><a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">搞定乱码，WordPress搬家到dreamhost</a></li><li ><a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">Dreamhost系统Load average负载记录和分析</a></li><li ><a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html">blog服务器搬家到bluehost</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2007. | <a href="http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html#comments">27 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>搞定乱码，WordPress搬家到dreamhost</title>
		<link>http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html</link>
		<comments>http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html#comments</comments>
		<pubDate>Mon, 03 Jul 2006 12:17:48 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[记事本]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[搬家]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/359.html</guid>
		<description><![CDATA[博客 » IT技术 » Dreamhost，mysql，phpmyadmin，WordPress，搬家，数据库 » 两个月前一时冲动，花了大约80大洋买了一年的dreamhost主机。刚买的时候就试图把Blog搬到它上面去，不过由于数据库的乱码原因，一直没有成功。最近，多个电信的朋友告诉我我的Blog速度&#8220;慢得不能忍受&#8221;，今天下午下定决心搞定数据库，哪知道一下子就弄了4个小时，到现在才基本上搞定。现在正式进...]]></description>
			<content:encoded><![CDATA[<p id="breadcrumb" class="breadcrumb"><a href="http://zhiqiang.org/blog/">博客</a> » <a href="http://zhiqiang.org/blog/category/it">IT技术</a> » <a href="http://zhiqiang.org/blog/tag/dreamhost" rel="tag">Dreamhost</a>，<a href="http://zhiqiang.org/blog/tag/mysql" rel="tag">mysql</a>，<a href="http://zhiqiang.org/blog/tag/phpmyadmin" rel="tag">phpmyadmin</a>，<a href="http://zhiqiang.org/blog/tag/wordpress" rel="tag">WordPress</a>，<a href="http://zhiqiang.org/blog/tag/%e6%90%ac%e5%ae%b6" rel="tag">搬家</a>，<a href="http://zhiqiang.org/blog/tag/%e6%95%b0%e6%8d%ae%e5%ba%93" rel="tag">数据库</a> » </p><p>两个月前一时冲动，花了大约80大洋买了一年的<a href="http://dreamhost.com/">dreamhost主机</a>。刚买的时候就试图把Blog搬到它上面去，不过由于数据库的乱码原因，一直没有成功。最近，多个电信的朋友告诉我我的Blog速度&ldquo;慢得不能忍受&rdquo;，今天下午下定决心搞定数据库，哪知道一下子就弄了4个小时，到现在才基本上搞定。现在正式进入测试期，欢迎报告Bug和异常情况。</p>
<p>先说一下我是怎么解决数据库乱码问题的。最开始的时候在phpmyadmin里面直接导入备份文件（使用WordPress自带的database backup生成），最后文章里面大部分显示正常，但是间或的有些汉字变成了乱码（在FireFox下变成两个?号）。在无数次失败的尝试和Baidu的帮助下，最后找到解决方案：</p>
<ol>
<li>使用WordPress自带的database backup生成备份文件（打开这个文件，里面中文是正常的，而如果直接从phpmyadmin里面导出数据库，中文都是乱码）。 </li>
<li>在phpMyadmin中设定MySQL 字符集: UTF-8 Unicode (utf8) （一般来说默认就是这个） </li>
<li>在phpMyadmin中设定MySQL 连接校对: utf8_general_ci </li>
<li><font color="#ff0000">用文本编辑器如EditPlus 打开备份的数据库文件，查找&quot;DEFAULT CHARSET=latin1&quot; 用&quot;DEFAULT CHARSET=utf8&quot;替换。</font> </li>
<li>用phpMyadmin导入上面修改过的备份文件。 </li>
<li>修改wp-includes/wp-db.php內的资料连线设定。详细的修改方式是这样的：<br />$this-&gt;dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);<br />//加上下面这行<br /><code>$this-&gt;query(&quot;SET NAMES 'utf8'&quot; );</code> </li>
</ol>
<p>这样做之后，不但页面上没有乱码，在数据库里面也可以直接看到中文。另外，在解决过程中得到了<a target="_blank" href="http://lucifr.com">Lucifer</a>和<a target="_blank" href="http://sunxiunan.com/">Sunwell</a>帮助，关键的一步从wordpress恢复数据库后乱码问题的解决看来的，一并表示感谢。</p>
<p>我和Dreamhost：</p>
<ul>
<li>我上Dreamhost还是太慢了，特别是它的FTP，无法忍受。 </li>
<li>Dreamhost的CPU速度比我原来的实验室的服务器还要慢，看看页面生成时间，有时候竟然需要2秒以上，郁闷。 </li>
<li>Dreamhost的服务器在国外，教育网访问需要代理，包括我自己，:(。 </li>
<li>不用担心备案问题了，不过我担心Dreamhost整体被封。 </li>
<li>十个月后空间到期后咋办呢？对我来说，搬家很快的，拎着数据库跑就行了。图片啥的我都放到Flickr和Picasa Web上了。不过寻找新空间是个大问题，暂时不管了。 </li>
</ul>
<p>另外，Dreamhost的unix主机的文件名是分大小写的，结果导致我有些ajax程序异常，不过现在已修正。</p>
<div><h4>相关文章</h4><ul><li class='currentpost'><a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">搞定乱码，WordPress搬家到dreamhost</a></li><li ><a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html">blog服务器搬家到bluehost</a></li><li ><a href="http://zhiqiang.org/blog/science/computer-science/move-blogbus-data-to-wordpress.html">BlogBus搬家文件转WordPress导入文件</a></li><li ><a href="http://zhiqiang.org/blog/it/dreamhost-on-gzip-cache.html">Dreamhost上的GZIP &#038; Cache</a></li><li ><a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">Dreamhost系统Load average负载记录和分析</a></li><li ><a href="http://zhiqiang.org/blog/it/speedup-blog-optimize-wordpress-database.html">加速blog：监测和优化WordPress数据库</a></li><li ><a href="http://zhiqiang.org/blog/science/computer-science/database-query-is-np-hard.html">数据库查询是NP-Hard问题</a></li><li ><a href="http://zhiqiang.org/blog/it/change-pivotcache-source.html">动态修改Excel数据表的数据来源</a></li><li ><a href="http://zhiqiang.org/blog/it/script-to-add-odbc-source.html">用脚本添加ODBC数据源</a></li><li ><a href="http://zhiqiang.org/blog/it/use-adodb-in-matlab.html">Matlab中使用ADODB访问数据库</a></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html#comments">46 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html/feed</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>

