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

<channel>
	<title>一个程序猿 &#187; php</title>
	<atom:link href="http://www.sunboyu.cn/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sunboyu.cn</link>
	<description>时光不会倒流,脚步总要前进</description>
	<lastBuildDate>Tue, 27 Jul 2010 06:24:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>图片动态缩放PHP与JS算法</title>
		<link>http://www.sunboyu.cn/2009/07/20/%e5%9b%be%e7%89%87%e5%8a%a8%e6%80%81%e7%bc%a9%e6%94%bephp%e4%b8%8ejs%e7%ae%97%e6%b3%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/20/%e5%9b%be%e7%89%87%e5%8a%a8%e6%80%81%e7%bc%a9%e6%94%bephp%e4%b8%8ejs%e7%ae%97%e6%b3%95.shtml#comments</comments>
		<pubDate>Mon, 20 Jul 2009 00:19:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[GD]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[图片缩放]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=875</guid>
		<description><![CDATA[这个算法写好多次了，虽然简单，但每次都得想一次，这里做个备份。
因为GD函数进行缩放，必须有宽和高，而在浏览器中，会自动按照比率调整宽高，所以两个函数稍有区别。
#PHP版
# $s_width&#160; 原图宽
# $s_height 原图高
# $t_width&#160; 目标文件最大宽
# $t_height 目标文件最大高
function ReSizePic( $s_width , $s_height , $t_width , $t_height)
{
	if( $s_width / $s_height &#62; $t_width / $t_height &#38;&#38; $s_width &#62; $t_width)
	{
		$t_height = $s_height * $t_width / $s_width;
		$t_width = $t_width;
	}
	else if( $s_width / $s_height &#62; $t_width / $t_height &#38;&#38; $s_width &#60; = $t_width)
	{
		$t_height = $s_height;
		$t_width&#160; = $s_width;
	}
	else if( $s_width [...]]]></description>
			<content:encoded><![CDATA[<p>这个算法写好多次了，虽然简单，但每次都得想一次，这里做个备份。</p>
<p>因为GD函数进行缩放，必须有宽和高，而在浏览器中，会自动按照比率调整宽高，所以两个函数稍有区别。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">#PHP版</li>
<li># $s_width&nbsp; 原图宽</li>
<li># $s_height 原图高</li>
<li># $t_width&nbsp; 目标文件最大宽</li>
<li># $t_height 目标文件最大高</li>
<li>function ReSizePic( $s_width , $s_height , $t_width , $t_height)</li>
<li>{</li>
<li>	if( $s_width / $s_height &gt; $t_width / $t_height &amp;&amp; $s_width &gt; $t_width)</li>
<li>	{</li>
<li>		$t_height = $s_height * $t_width / $s_width;</li>
<li>		$t_width = $t_width;</li>
<li>	}</li>
<li>	else if( $s_width / $s_height &gt; $t_width / $t_height &amp;&amp; $s_width &lt; = $t_width)</li>
<li>	{</li>
<li>		$t_height = $s_height;</li>
<li>		$t_width&nbsp; = $s_width;</li>
<li>	}</li>
<li>	else if( $s_width / $s_height &lt; $t_width / $t_height &amp;&amp; $s_height &gt; $t_height)</li>
<li>	{</li>
<li>		$t_width = $s_width*$t_height/$s_height;</li>
<li>		$t_height = $t_height;</li>
<li>	}</li>
<li>	else if( $s_width / $s_height &lt; $t_width / $t_height &amp;&amp; $s_height &lt;= $t_height)</li>
<li>	{</li>
<li>		$t_height = $s_height;</li>
<li>		$t_width&nbsp; = $s_width;</li>
<li>	}</li>
<li>	return array( &quot;width&quot; =&gt; $t_width , &quot;height&quot; =&gt; $t_height );</li>
<li>}</li>
<li>#JS版</li>
<li># obj 图片对象</li>
<li># maxWidth 显示最大宽</li>
<li># maxHeight 显示最大高</li>
<li>function ReSizePic( obj , maxWidth , maxHeight )</li>
<li>{</li>
<li>	if( ( obj.width/obj.height &gt;= maxWidth/maxHeight ) &amp;&amp; obj.width &gt; maxWidth )</li>
<li>	{</li>
<li>		obj.width = maxWidth;</li>
<li>	}</li>
<li>	else if( ( obj.width/obj.height &lt; maxWidth/maxHeight ) &amp;&amp; obj.height &gt; maxHeight )</li>
<li>	{</li>
<li>		obj.height = maxHeight;</li>
<li>	}</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/20/%e5%9b%be%e7%89%87%e5%8a%a8%e6%80%81%e7%bc%a9%e6%94%bephp%e4%b8%8ejs%e7%ae%97%e6%b3%95.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>在windows下玩apache php不能不知的几个小设置</title>
		<link>http://www.sunboyu.cn/2009/06/10/%e5%9c%a8windows%e4%b8%8b%e7%8e%a9apache-php%e4%b8%8d%e8%83%bd%e4%b8%8d%e7%9f%a5%e7%9a%84%e5%87%a0%e4%b8%aa%e5%b0%8f%e8%ae%be%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/06/10/%e5%9c%a8windows%e4%b8%8b%e7%8e%a9apache-php%e4%b8%8d%e8%83%bd%e4%b8%8d%e7%9f%a5%e7%9a%84%e5%87%a0%e4%b8%aa%e5%b0%8f%e8%ae%be%e7%bd%ae.shtml#comments</comments>
		<pubDate>Wed, 10 Jun 2009 09:09:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[APACHE]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=779</guid>
		<description><![CDATA[1、PHPIniDir &#8220;D:\PHP5&#8243;
这样不用每次都把php.ini拷贝到C:\Windows下
2、set Path=D:\PHP5;D:\PHP5\ext;%Path%
这样不用每次把那些dll拷贝到C:\Windows\system32下
]]></description>
			<content:encoded><![CDATA[<p>1、PHPIniDir &#8220;D:\PHP5&#8243;</p>
<p>这样不用每次都把php.ini拷贝到C:\Windows下</p>
<p>2、set Path=D:\PHP5;D:\PHP5\ext;%Path%</p>
<p>这样不用每次把那些dll拷贝到C:\Windows\system32下</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/06/10/%e5%9c%a8windows%e4%b8%8b%e7%8e%a9apache-php%e4%b8%8d%e8%83%bd%e4%b8%8d%e7%9f%a5%e7%9a%84%e5%87%a0%e4%b8%aa%e5%b0%8f%e8%ae%be%e7%bd%ae.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>设计标准的通讯协议</title>
		<link>http://www.sunboyu.cn/2009/05/17/%e8%ae%be%e8%ae%a1%e6%a0%87%e5%87%86%e7%9a%84%e9%80%9a%e8%ae%af%e5%8d%8f%e8%ae%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/17/%e8%ae%be%e8%ae%a1%e6%a0%87%e5%87%86%e7%9a%84%e9%80%9a%e8%ae%af%e5%8d%8f%e8%ae%ae.shtml#comments</comments>
		<pubDate>Sun, 17 May 2009 15:48:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[原创技术]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[协议]]></category>
		<category><![CDATA[虚拟主机]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=710</guid>
		<description><![CDATA[当然不会是底层通讯协议，因为TCP/IP已经为我们准备好了足够完善的通讯机制确保稳定安全。
此协议为七层应用协议，跟http ftp是平级的，使用socket进行通讯，可以兼容php、python、java、c等语言。
协议开源，使用点对点信息校验，满足普通应用。
协议模拟tcp封包过程，进行数据封装。
协议内容：(伪代码)
struct vhost
{
&#160;&#160; &#160;Head varchar(10),&#160; &#160; &#160; &#160; &#160; &#160; //协议头
&#160;&#160; &#160;Version int(5),&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;//版本
&#160;&#160; &#160;Timestamp int(5),&#160; &#160; &#160; &#160; &#160; &#160; //时间戳
&#160;&#160; &#160;Length int(10),&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; //包长度
&#160;&#160; &#160;Signature varchar(10),&#160; &#160; &#160; //签名
&#160;&#160; &#160;Date varchar(500)&#160; &#160; &#160; &#160; &#160; &#160; //数据 
}
协议包包括了协议头，版本，时间戳，包长度、签名（防止数据篡改和伪造）,数据。基本能满足应用。
控制端数据打包发送后，受控端只需返回接受成功即可，以便客户端及时作出判断。
底下针对此包做PHP版本的封包和python的解包部分。
注释：原来使用问答的方式进行通讯，需要多次数据的应答，而此次的修改只需一次即可完成，而打包封包在一端完成，这样对网络稳定性的依赖就会降低。
]]></description>
			<content:encoded><![CDATA[<p>当然不会是底层通讯协议，因为TCP/IP已经为我们准备好了足够完善的通讯机制确保稳定安全。</p>
<p>此协议为七层应用协议，跟http ftp是平级的，使用socket进行通讯，可以兼容php、python、java、c等语言。</p>
<p>协议开源，使用点对点信息校验，满足普通应用。</p>
<p>协议模拟tcp封包过程，进行数据封装。</p>
<p>协议内容：(伪代码)</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">struct vhost</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;Head varchar(10),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //协议头</li>
<li>&nbsp;&nbsp; &nbsp;Version int(5),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//版本</li>
<li>&nbsp;&nbsp; &nbsp;Timestamp int(5),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //时间戳</li>
<li>&nbsp;&nbsp; &nbsp;Length int(10),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //包长度</li>
<li>&nbsp;&nbsp; &nbsp;Signature varchar(10),&nbsp; &nbsp; &nbsp; //签名</li>
<li>&nbsp;&nbsp; &nbsp;Date varchar(500)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //数据 </li>
<li>}</li></ol></div>
<p>协议包包括了协议头，版本，时间戳，包长度、签名（防止数据篡改和伪造）,数据。基本能满足应用。</p>
<p>控制端数据打包发送后，受控端只需返回接受成功即可，以便客户端及时作出判断。</p>
<p>底下针对此包做PHP版本的封包和python的解包部分。</p>
<p>注释：原来使用问答的方式进行通讯，需要多次数据的应答，而此次的修改只需一次即可完成，而打包封包在一端完成，这样对网络稳定性的依赖就会降低。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/17/%e8%ae%be%e8%ae%a1%e6%a0%87%e5%87%86%e7%9a%84%e9%80%9a%e8%ae%af%e5%8d%8f%e8%ae%ae.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP DeZend真的很爽</title>
		<link>http://www.sunboyu.cn/2009/05/02/php-dezend%e7%9c%9f%e7%9a%84%e5%be%88%e7%88%bd.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/02/php-dezend%e7%9c%9f%e7%9a%84%e5%be%88%e7%88%bd.shtml#comments</comments>
		<pubDate>Fri, 01 May 2009 16:19:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[dezend]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=681</guid>
		<description><![CDATA[突然在网上发现一套我渴望已久的IDC管理软件，下载下来，除用vb之类的加密外，其源代码是用zend加密过的PHP代码。大喜，网上找到这个工具，然后迅速反接后，看到所有源代码。开始研究。
PHP DeZend
]]></description>
			<content:encoded><![CDATA[<p>突然在网上发现一套我渴望已久的IDC管理软件，下载下来，除用vb之类的加密外，其源代码是用zend加密过的PHP代码。大喜，网上找到这个工具，然后迅速反接后，看到所有源代码。开始研究。</p>
<p><a href='http://www.sunboyu.cn/upfiles/2009/05/phpe7a0b4e8a7a3dezender5.rar'>PHP DeZend</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/02/php-dezend%e7%9c%9f%e7%9a%84%e5%be%88%e7%88%bd.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>解决了该死的权限问题，是否真的有效</title>
		<link>http://www.sunboyu.cn/2009/03/12/%e8%a7%a3%e5%86%b3%e4%ba%86%e8%af%a5%e6%ad%bb%e7%9a%84%e6%9d%83%e9%99%90%e9%97%ae%e9%a2%98%ef%bc%8c%e6%98%af%e5%90%a6%e7%9c%9f%e7%9a%84%e6%9c%89%e6%95%88.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/12/%e8%a7%a3%e5%86%b3%e4%ba%86%e8%af%a5%e6%ad%bb%e7%9a%84%e6%9d%83%e9%99%90%e9%97%ae%e9%a2%98%ef%bc%8c%e6%98%af%e5%90%a6%e7%9c%9f%e7%9a%84%e6%9c%89%e6%95%88.shtml#comments</comments>
		<pubDate>Thu, 12 Mar 2009 15:43:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=600</guid>
		<description><![CDATA[我的apache＋php权限是配置的最为严格的，当然，在用的时候难免伴随着混乱的账户情况，linux的权限机制也是很让人头疼的，终于，还是在风平浪静种碰到了麻烦。
我不认为PHP很强，因为它只是一个面向Web的脚本语言，而PHP的开发者却赋予了它太多，让人去用，有人也滥用。
当然，一门语言能解决N多问题是好的，比如汇编，C，但终究PHP有它跨不过的坎。毕竟它只是web脚本语言。
权限出现很大的问题，至今没有搞透，说白了对linux还是一知半解，使用python写了个第三方的东西，很完美得跳跃了权限的问题。至于效率，python肯定要比php强的，起码PHP作为服务器端程序运行，PHP还没有线程和进程的控制（一直没有发现），python有完善的线程进程的库。在权限管理上，python没细看，PHP在linux下有posix函数库，我一直也没有用过。
在没有更好的解决方案前，我依然用PHP做服务器端程序，python作为一些补充。也许，全部切换过去。
]]></description>
			<content:encoded><![CDATA[<p>我的apache＋php权限是配置的最为严格的，当然，在用的时候难免伴随着混乱的账户情况，linux的权限机制也是很让人头疼的，终于，还是在风平浪静种碰到了麻烦。</p>
<p>我不认为PHP很强，因为它只是一个面向Web的脚本语言，而PHP的开发者却赋予了它太多，让人去用，有人也滥用。</p>
<p>当然，一门语言能解决N多问题是好的，比如汇编，C，但终究PHP有它跨不过的坎。毕竟它只是web脚本语言。</p>
<p>权限出现很大的问题，至今没有搞透，说白了对linux还是一知半解，使用python写了个第三方的东西，很完美得跳跃了权限的问题。至于效率，python肯定要比php强的，起码PHP作为服务器端程序运行，PHP还没有线程和进程的控制（一直没有发现），python有完善的线程进程的库。在权限管理上，python没细看，PHP在linux下有posix函数库，我一直也没有用过。</p>
<p>在没有更好的解决方案前，我依然用PHP做服务器端程序，python作为一些补充。也许，全部切换过去。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/12/%e8%a7%a3%e5%86%b3%e4%ba%86%e8%af%a5%e6%ad%bb%e7%9a%84%e6%9d%83%e9%99%90%e9%97%ae%e9%a2%98%ef%bc%8c%e6%98%af%e5%90%a6%e7%9c%9f%e7%9a%84%e6%9c%89%e6%95%88.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用linux进程来分布PHP的压力，构造高负载多并发的系统</title>
		<link>http://www.sunboyu.cn/2008/12/25/%e4%bd%bf%e7%94%a8linux%e8%bf%9b%e7%a8%8b%e6%9d%a5%e5%88%86%e5%b8%83php%e7%9a%84%e5%8e%8b%e5%8a%9b%ef%bc%8c%e6%9e%84%e9%80%a0%e9%ab%98%e8%b4%9f%e8%bd%bd%e5%a4%9a%e5%b9%b6%e5%8f%91%e7%9a%84%e7%b3%bb.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/25/%e4%bd%bf%e7%94%a8linux%e8%bf%9b%e7%a8%8b%e6%9d%a5%e5%88%86%e5%b8%83php%e7%9a%84%e5%8e%8b%e5%8a%9b%ef%bc%8c%e6%9e%84%e9%80%a0%e9%ab%98%e8%b4%9f%e8%bd%bd%e5%a4%9a%e5%b9%b6%e5%8f%91%e7%9a%84%e7%b3%bb.shtml#comments</comments>
		<pubDate>Thu, 25 Dec 2008 07:42:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[压力，进程]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=437</guid>
		<description><![CDATA[最近又跟P友讨论PHP的多进程问题，解决的方案，一般都是建立新的系统进程去处理，而linux的nohup命令可以创建新的进程，如果主程序需要处理很多数据，比如一个队列，把这些记录分布开，可以提高主程序的响应，能更快的使主程序结束。
这个方案最早出现在这哥们的博客里，大家可以参考 http://blog.s135.com/read.php/311.htm
而我处理，基本基于PHP的cli模式，使用$argv传递参数而非url，在一些涉及轮询的程序中，可以尽快得把负载分散，使单一的轮询程序来处理下一次的轮询。
]]></description>
			<content:encoded><![CDATA[<p>最近又跟P友讨论PHP的多进程问题，解决的方案，一般都是建立新的系统进程去处理，而linux的nohup命令可以创建新的进程，如果主程序需要处理很多数据，比如一个队列，把这些记录分布开，可以提高主程序的响应，能更快的使主程序结束。</p>
<p>这个方案最早出现在这哥们的博客里，大家可以参考 http://blog.s135.com/read.php/311.htm</p>
<p>而我处理，基本基于PHP的cli模式，使用$argv传递参数而非url，在一些涉及轮询的程序中，可以尽快得把负载分散，使单一的轮询程序来处理下一次的轮询。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/25/%e4%bd%bf%e7%94%a8linux%e8%bf%9b%e7%a8%8b%e6%9d%a5%e5%88%86%e5%b8%83php%e7%9a%84%e5%8e%8b%e5%8a%9b%ef%bc%8c%e6%9e%84%e9%80%a0%e9%ab%98%e8%b4%9f%e8%bd%bd%e5%a4%9a%e5%b9%b6%e5%8f%91%e7%9a%84%e7%b3%bb.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sunboyu-amp-fastcgi-suexec-v21-alpha 发布</title>
		<link>http://www.sunboyu.cn/2008/12/15/sunboyu-amp-fastcgi-suexec-v21-alpha-%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/15/sunboyu-amp-fastcgi-suexec-v21-alpha-%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Mon, 15 Dec 2008 13:58:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[suexec]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=428</guid>
		<description><![CDATA[Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.1
1、增加了PHP &#8211;enable-bcmath 参数，支持高精度函数库
2、增加了ncurses MYSQL的一个依赖库
3、增加了apache &#8211;enable-so 参数
sunboyu-amp-fastcgi-suexec-v21-alpha
此脚本在Centos4.7ServerCD 最小安装，root账户下执行完全正常。
]]></description>
			<content:encoded><![CDATA[<p>Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.1<br />
1、增加了PHP &#8211;enable-bcmath 参数，支持高精度函数库<br />
2、增加了ncurses MYSQL的一个依赖库<br />
3、增加了apache &#8211;enable-so 参数</p>
<p><a href='http://www.sunboyu.cn/upfiles/2008/12/sunboyu-amp-fastcgi-suexec-v21-alpha.txt'>sunboyu-amp-fastcgi-suexec-v21-alpha</a></p>
<p>此脚本在Centos4.7ServerCD 最小安装，root账户下执行完全正常。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/15/sunboyu-amp-fastcgi-suexec-v21-alpha-%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP引用机制和垃圾回收机制详解</title>
		<link>http://www.sunboyu.cn/2008/12/12/php%e5%bc%95%e7%94%a8%e6%9c%ba%e5%88%b6%e5%92%8c%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/12/php%e5%bc%95%e7%94%a8%e6%9c%ba%e5%88%b6%e5%92%8c%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Fri, 12 Dec 2008 14:16:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[垃圾回收]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=426</guid>
		<description><![CDATA[PHP对变量的跟踪，其实是采用引用，比如 $a = &#8220;test&#8221; 那么就是在内存中开辟一个存储区，保存 test，$a 做为test的引用。
同时我们可以 $b = &#38;$a,$b作为 $a的引用，他们同时指向test存储空间。
在文章  http://www.sunboyu.cn/2008/11/19/php%E4%B8%AD%E5%8F%98%E9%87%8F%E5%BC%95%E7%94%A8%E8%AF%A6%E8%A7%A3.shtml    中，我们做了一个应用的测试，当删除一个引用后，变量并不消失，是因为PHP使用一个引用计数的东东。当$a=&#8221;test&#8221;建立后，test的引用计数就是1，建立 $b=&#38;$a后，test的引用计数就是2，删除任何一个引用后，引用计数为1.
只要是引用计数不为0的数据，则为当前有效的数据。然而，当数据的引用计数为0的时候，系统就会识别此数据为垃圾数据，需要回收，这也就形成了PHP的垃圾回收机制。
]]></description>
			<content:encoded><![CDATA[<p>PHP对变量的跟踪，其实是采用引用，比如 $a = &#8220;test&#8221; 那么就是在内存中开辟一个存储区，保存 test，$a 做为test的引用。</p>
<p>同时我们可以 $b = &amp;$a,$b作为 $a的引用，他们同时指向test存储空间。</p>
<p>在文章  http://www.sunboyu.cn/2008/11/19/php%E4%B8%AD%E5%8F%98%E9%87%8F%E5%BC%95%E7%94%A8%E8%AF%A6%E8%A7%A3.shtml    中，我们做了一个应用的测试，当删除一个引用后，变量并不消失，是因为PHP使用一个引用计数的东东。当$a=&#8221;test&#8221;建立后，test的引用计数就是1，建立 $b=&amp;$a后，test的引用计数就是2，删除任何一个引用后，引用计数为1.</p>
<p>只要是引用计数不为0的数据，则为当前有效的数据。然而，当数据的引用计数为0的时候，系统就会识别此数据为垃圾数据，需要回收，这也就形成了PHP的垃圾回收机制。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/12/php%e5%bc%95%e7%94%a8%e6%9c%ba%e5%88%b6%e5%92%8c%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决php模块ssh2的编译问题</title>
		<link>http://www.sunboyu.cn/2008/12/07/%e8%a7%a3%e5%86%b3php%e6%a8%a1%e5%9d%97ssh2%e7%9a%84%e7%bc%96%e8%af%91%e9%97%ae%e9%a2%98.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/07/%e8%a7%a3%e5%86%b3php%e6%a8%a1%e5%9d%97ssh2%e7%9a%84%e7%bc%96%e8%af%91%e9%97%ae%e9%a2%98.shtml#comments</comments>
		<pubDate>Sun, 07 Dec 2008 13:50:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ssh2]]></category>
		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=415</guid>
		<description><![CDATA[这个问题一google就出来了，官方给出的解决方案，
在config.h里加上一个宏定义 #define LIBSSH2_APINO 200412301450,哇塞，一切OK
http://pecl.php.net/bugs/bug.php?id=9656
/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_methods_negotiated':
/root/ssh2-0.10/ssh2.c:483: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:484: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:485: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:486: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:487: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:488: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:489: [...]]]></description>
			<content:encoded><![CDATA[<p>这个问题一google就出来了，官方给出的解决方案，<br />
在config.h里加上一个宏定义 #define LIBSSH2_APINO 200412301450,哇塞，一切OK<br />
http://pecl.php.net/bugs/bug.php?id=9656</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_methods_negotiated':</li>
<li>/root/ssh2-0.10/ssh2.c:483: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:484: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:485: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:486: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:487: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:488: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:489: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:490: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:491: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:492: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_fingerprint':</li>
<li>/root/ssh2-0.10/ssh2.c:536: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_publickey_add':</li>
<li>/root/ssh2-0.10/ssh2.c:1038: warning: passing argument 1 of '_efree' discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_publickey_list':</li>
<li>/root/ssh2-0.10/ssh2.c:1097: warning: passing argument 4 of 'add_assoc_stringl_ex' discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:1098: warning: passing argument 4 of 'add_assoc_stringl_ex' discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:1106: warning: initialization discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:1107: warning: passing argument 2 of '_zend_hash_add_or_update' discards qualifiers from pointer target type</li>
<li>/bin/sh /root/ssh2-0.10/libtool --mode=compile gcc&nbsp; -I. -I</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/07/%e8%a7%a3%e5%86%b3php%e6%a8%a1%e5%9d%97ssh2%e7%9a%84%e7%bc%96%e8%af%91%e9%97%ae%e9%a2%98.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>山穷水复疑无路，柳暗花明又一村</title>
		<link>http://www.sunboyu.cn/2008/12/07/%e5%b1%b1%e7%a9%b7%e6%b0%b4%e5%a4%8d%e7%96%91%e6%97%a0%e8%b7%af%ef%bc%8c%e6%9f%b3%e6%9a%97%e8%8a%b1%e6%98%8e%e5%8f%88%e4%b8%80%e6%9d%91.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/07/%e5%b1%b1%e7%a9%b7%e6%b0%b4%e5%a4%8d%e7%96%91%e6%97%a0%e8%b7%af%ef%bc%8c%e6%9f%b3%e6%9a%97%e8%8a%b1%e6%98%8e%e5%8f%88%e4%b8%80%e6%9d%91.shtml#comments</comments>
		<pubDate>Sat, 06 Dec 2008 16:13:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ssh2]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=413</guid>
		<description><![CDATA[学习就是这样，突然发现了PHP居然有ssh2的模块，这样远程连接linux服务器就很容易，我正头疼用socket写个ssh2的连接类，突然就发现了这个玩意。手册看得还是少，罚吃巧克力一块。
官方文档:http://www.php.net/manual/en/book.ssh2.php
]]></description>
			<content:encoded><![CDATA[<p>学习就是这样，突然发现了PHP居然有ssh2的模块，这样远程连接linux服务器就很容易，我正头疼用socket写个ssh2的连接类，突然就发现了这个玩意。手册看得还是少，罚吃巧克力一块。<br />
官方文档:http://www.php.net/manual/en/book.ssh2.php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/07/%e5%b1%b1%e7%a9%b7%e6%b0%b4%e5%a4%8d%e7%96%91%e6%97%a0%e8%b7%af%ef%bc%8c%e6%9f%b3%e6%9a%97%e8%8a%b1%e6%98%8e%e5%8f%88%e4%b8%80%e6%9d%91.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5.2.7RC版本发布</title>
		<link>http://www.sunboyu.cn/2008/12/04/php527rc%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/04/php527rc%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Thu, 04 Dec 2008 04:01:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5.2.7]]></category>
		<category><![CDATA[发布]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=410</guid>
		<description><![CDATA[官方地址 http://qa.php.net/
下载地址 http://downloads.php.net/ilia/php-5.2.7RC5.tar.gz
]]></description>
			<content:encoded><![CDATA[<p>官方地址 http://qa.php.net/</p>
<p>下载地址 http://downloads.php.net/ilia/php-5.2.7RC5.tar.gz</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/04/php527rc%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows下安装Apache，Mysql，PHP过程详解</title>
		<link>http://www.sunboyu.cn/2008/12/04/windows%e4%b8%8b%e5%ae%89%e8%a3%85apache%ef%bc%8cmysql%ef%bc%8cphp%e8%bf%87%e7%a8%8b%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/04/windows%e4%b8%8b%e5%ae%89%e8%a3%85apache%ef%bc%8cmysql%ef%bc%8cphp%e8%bf%87%e7%a8%8b%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Thu, 04 Dec 2008 01:40:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wamp]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=409</guid>
		<description><![CDATA[原则：使用官方程序，完全自己配置，不使用其他辅助工具套件等。
准备：
apache2.2.*   http://httpd.apache.org/download.cgi   如果有stable版本，最好用stable版，其实最新版作为调试也不错
PHP5.2.*  http://www.php.net/downloads.php  目前是5.2.6
mysql5.1  http://dev.mysql.com/downloads/mysql/5.1.html  下载windows安装版本
1、安装Apache，安装路径随意，默认即可，手工管理更好，建议放到 d:\Apache 放D盘是为了以后重装的话，所有的配置文件都还在（备份不仅要备份数据，还要备份不起眼的配置文件）
2、安装Mysql，同上，安装到 D:\Mysql  理由同上
3、解压PHP5.2.×至目录 D:\PHP5 理由还是同上
4、配置环境变量：在桌面上找到“我的电脑”，右键点击“我的电脑”，选择“属性”里的“高级”标签，点击“环境变量”，在“系统变量”里找到“Path”，点击“编辑”按钮，在“变量值”后面加上“;D:\PHP5\;D:\PHP5\ext”，然后点“确定”退出。环境变量配置完成。（windows下Path环境变量是做什么用，google一下先，这样设置后，系统会自动搜索PHP目录里的可执行文件和加载类库）
5、进入PHP5目录下，找到php.ini-dist文件，将其复制到C盘的WINDOWS目录下，并将其文件名修改为“php.ini”。（php会默认从这个路径找php.ini这个文件，当然也可以手工指定这个目录，修改apache的配置文件即可）
6、再次进入PHP5目录下，将以下文件复制到C盘的WINDOWS目录下的System32里：（原因，我也不太清楚，但貌似可以设置一个环境变量指向这个路径就ok，那个方法一直没找到，也没理解）
fdftk.dll
gds32.dll
libeay32.dll
libmcrypt.dll
libmhash.dll
libmysql.dll
msql.dll
news.txt
ntwdblib.dll
7、打开Apache的主目录，进入conf文件夹，找到“httpd.conf”文件，为操作方便起见，建议使用Dreamweaver打开它。打开后在第126行左右找到 LoadModule vhost_alias_module modules/mod_vhost_alias.so，在后面添加以下语句：
LoadModule php5_module &#8220;D:/PHP5/php5apache2_2_filter.dll
&#8220;AddType application/x-httpd-php .php
添加完成后保存文件。
8、在apache主目录下htdocs下创建index.php文件，内容为&#60;?php phpinfo(); ?&#62;保存。
9、在浏览器的地址栏里输入http://127.0.0.1/index.php。即可打开显示PHP信息的页面。配置成功。
]]></description>
			<content:encoded><![CDATA[<p>原则：使用官方程序，完全自己配置，不使用其他辅助工具套件等。</p>
<p>准备：</p>
<p>apache2.2.*   http://httpd.apache.org/download.cgi   如果有stable版本，最好用stable版，其实最新版作为调试也不错</p>
<p>PHP5.2.*  http://www.php.net/downloads.php  目前是5.2.6</p>
<p>mysql5.1  http://dev.mysql.com/downloads/mysql/5.1.html  下载windows安装版本</p>
<p>1、安装Apache，安装路径随意，默认即可，手工管理更好，建议放到 d:\Apache 放D盘是为了以后重装的话，所有的配置文件都还在（备份不仅要备份数据，还要备份不起眼的配置文件）</p>
<p>2、安装Mysql，同上，安装到 D:\Mysql  理由同上</p>
<p>3、解压PHP5.2.×至目录 D:\PHP5 理由还是同上</p>
<p>4、配置环境变量：在桌面上找到“我的电脑”，右键点击“我的电脑”，选择“属性”里的“高级”标签，点击“环境变量”，在“系统变量”里找到“Path”，点击“编辑”按钮，在“变量值”后面加上“;D:\PHP5\;D:\PHP5\ext”，然后点“确定”退出。环境变量配置完成。（windows下Path环境变量是做什么用，google一下先，这样设置后，系统会自动搜索PHP目录里的可执行文件和加载类库）</p>
<p>5、进入PHP5目录下，找到php.ini-dist文件，将其复制到C盘的WINDOWS目录下，并将其文件名修改为“php.ini”。（php会默认从这个路径找php.ini这个文件，当然也可以手工指定这个目录，修改apache的配置文件即可）</p>
<p>6、再次进入PHP5目录下，将以下文件复制到C盘的WINDOWS目录下的System32里：（原因，我也不太清楚，但貌似可以设置一个环境变量指向这个路径就ok，那个方法一直没找到，也没理解）<br />
fdftk.dll<br />
gds32.dll<br />
libeay32.dll<br />
libmcrypt.dll<br />
libmhash.dll<br />
libmysql.dll<br />
msql.dll<br />
news.txt<br />
ntwdblib.dll</p>
<p>7、打开Apache的主目录，进入conf文件夹，找到“httpd.conf”文件，为操作方便起见，建议使用Dreamweaver打开它。打开后在第126行左右找到 LoadModule vhost_alias_module modules/mod_vhost_alias.so，在后面添加以下语句：<br />
LoadModule php5_module &#8220;D:/PHP5/php5apache2_2_filter.dll<br />
&#8220;AddType application/x-httpd-php .php<br />
添加完成后保存文件。</p>
<p>8、在apache主目录下htdocs下创建index.php文件，内容为&lt;?php phpinfo(); ?&gt;保存。</p>
<p>9、在浏览器的地址栏里输入http://127.0.0.1/index.php。即可打开显示PHP信息的页面。配置成功。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/04/windows%e4%b8%8b%e5%ae%89%e8%a3%85apache%ef%bc%8cmysql%ef%bc%8cphp%e8%bf%87%e7%a8%8b%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux_apache_php_mysql_fcgid_suexec_高效安全的主机配置方案</title>
		<link>http://www.sunboyu.cn/2008/11/08/linux_apache_php_mysql_fcgid_suexec_%e9%ab%98%e6%95%88%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%e6%96%b9%e6%a1%88.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/08/linux_apache_php_mysql_fcgid_suexec_%e9%ab%98%e6%95%88%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%e6%96%b9%e6%a1%88.shtml#comments</comments>
		<pubDate>Sat, 08 Nov 2008 14:35:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[fcgid]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[suexec]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=376</guid>
		<description><![CDATA[linux+apache+php+mysql+fcgid+suexec 高效安全主机配置
最近一直在研究web服务器的配置和安全配置，基本搞完了
window2003下
iis+php(isapi)
apache+php(mod)
linux下
apache+php(mod)
apache+php(fastcgi)
四种安装方式的安全设置。其中涉及一些性能方面的调整，但没有实际的环境来测试，所以只涉及方法，不涉及具体的应用，而在安全方面下了很大的功夫。
底下我针对比较复杂的一种安装模式apache+php(fastcgi)进行详细讲解，来介绍如何配置一个安全的虚拟主机系统。
调试环境：
CentOS5
Apache2.2.9
Mysql5.0.22
PHP5.2.6
Fcgid2.4.6
需要的脚本  sunboyu-amp-fastcgi-suexec-v20-alpha
首先用脚本 unboyu-amp-fastcgi-v20-fcgid-suexec-alpha.txt 进行安装。
注：我在我的服务器上做了一个源，如果你感觉较慢的话，可以先吧软件下载到本地，然后修改一下脚本进行安装。
整体运行完后，apache是能成功运行的，但访问的话显示权限错误，底下主要是配置权限
过程用命令来显示，比较符合技术人员的习惯
1、vi /opt/httpd-2.2.9/conf/httpd.conf
修改 User daemon
Group daemon
为 User apache
Group apache
去掉 #Include conf/extra/httpd-vhosts.conf 前边的#，使其生效
2、增加一个虚拟站点的账户
groupadd www
useradd -g www www
现在应该有个目录 /home/www
3、vi /opt/httpd-2.2.9/conf/extra/httpd-vhost.conf
屏蔽或直接删除原来的站点信息
SuexecUserGroup www www #这里一定要弄清楚是做什么用的
ServerAdmin sunboyu@gmail.com
DocumentRoot &#8220;/home/www/php-cgi&#8221;
ServerName 192.168.0.5 #我测试的ip是这个，实际应该为你的域名
ServerAlias www.dummy-host.example.com #别名
ErrorLog &#8220;logs/dummy-host.example.com-error_log&#8221; #日志，用独立的名字
CustomLog &#8220;logs/dummy-host.example.com-access_log&#8221; common
SetHandler fcgid-script #我在编译完apache，附加了两个模块，fastcgi和fcgid，后一个是国人开发的，比fastcgi更稳定和易用
FCGIWrapper /home/www/php/php-cgi .php # php-cgi 是站点下的一个文件，下边建立
Options ExecCGI
allow from all
然后: x 即可
4、建立脚本 /home/www/php/php-cgi
vi /home/www/php/php-cgi
内容为
#!/bin/sh
export PHPRC=/home/www/php-cgi
export PHP_FCGI_CHILDREN=5 #创建的fcgi进程
export PHP_FCGI_MAX_REQUESTS=5000 #最大连接数
/opt/php-5.2.6/bin/php-cgi #php-cgi程序的位置
: x
5、创建独立的php.ini配置文件
cp [...]]]></description>
			<content:encoded><![CDATA[<p>linux+apache+php+mysql+fcgid+suexec 高效安全主机配置</p>
<p>最近一直在研究web服务器的配置和安全配置，基本搞完了<br />
window2003下<br />
iis+php(isapi)<br />
apache+php(mod)<br />
linux下<br />
apache+php(mod)<br />
apache+php(fastcgi)<br />
四种安装方式的安全设置。其中涉及一些性能方面的调整，但没有实际的环境来测试，所以只涉及方法，不涉及具体的应用，而在安全方面下了很大的功夫。<br />
底下我针对比较复杂的一种安装模式apache+php(fastcgi)进行详细讲解，来介绍如何配置一个安全的虚拟主机系统。</p>
<p>调试环境：</p>
<p>CentOS5<br />
Apache2.2.9<br />
Mysql5.0.22<br />
PHP5.2.6<br />
Fcgid2.4.6</p>
<p>需要的脚本  <a href='http://www.sunboyu.cn/upfiles/2008/12/sunboyu-amp-fastcgi-suexec-v20-alpha.txt'>sunboyu-amp-fastcgi-suexec-v20-alpha</a></p>
<p>首先用脚本 unboyu-amp-fastcgi-v20-fcgid-suexec-alpha.txt 进行安装。<br />
注：我在我的服务器上做了一个源，如果你感觉较慢的话，可以先吧软件下载到本地，然后修改一下脚本进行安装。</p>
<p>整体运行完后，apache是能成功运行的，但访问的话显示权限错误，底下主要是配置权限<br />
过程用命令来显示，比较符合技术人员的习惯<br />
1、vi /opt/httpd-2.2.9/conf/httpd.conf</p>
<p>修改 User daemon<br />
Group daemon<br />
为 User apache<br />
Group apache</p>
<p>去掉 #Include conf/extra/httpd-vhosts.conf 前边的#，使其生效</p>
<p>2、增加一个虚拟站点的账户</p>
<p>groupadd www<br />
useradd -g www www</p>
<p>现在应该有个目录 /home/www</p>
<p>3、vi /opt/httpd-2.2.9/conf/extra/httpd-vhost.conf</p>
<p>屏蔽或直接删除原来的站点信息<br />
SuexecUserGroup www www #这里一定要弄清楚是做什么用的<br />
ServerAdmin sunboyu@gmail.com<br />
DocumentRoot &#8220;/home/www/php-cgi&#8221;<br />
ServerName 192.168.0.5 #我测试的ip是这个，实际应该为你的域名<br />
ServerAlias www.dummy-host.example.com #别名<br />
ErrorLog &#8220;logs/dummy-host.example.com-error_log&#8221; #日志，用独立的名字<br />
CustomLog &#8220;logs/dummy-host.example.com-access_log&#8221; common</p>
<p>SetHandler fcgid-script #我在编译完apache，附加了两个模块，fastcgi和fcgid，后一个是国人开发的，比fastcgi更稳定和易用<br />
FCGIWrapper /home/www/php/php-cgi .php # php-cgi 是站点下的一个文件，下边建立<br />
Options ExecCGI<br />
allow from all<br />
然后: x 即可</p>
<p>4、建立脚本 /home/www/php/php-cgi</p>
<p>vi /home/www/php/php-cgi<br />
内容为<br />
#!/bin/sh<br />
export PHPRC=/home/www/php-cgi<br />
export PHP_FCGI_CHILDREN=5 #创建的fcgi进程<br />
export PHP_FCGI_MAX_REQUESTS=5000 #最大连接数<br />
/opt/php-5.2.6/bin/php-cgi #php-cgi程序的位置</p>
<p>: x</p>
<p>5、创建独立的php.ini配置文件<br />
cp /opt/php-5.2.6/lib/php.ini /home/www/php-cgi/php.ini</p>
<p>6、修改PHP的open_basedir</p>
<p>在/home/www/php-cgi/php.ini中找到<br />
open_basedir , 修改为<br />
open_basedir = /home/www/php<br />
注：safe_mode_exec_dir 之类的参数如果从比较变态的安全设置来说，也是应该来设定的，但我还不变态</p>
<p>7、配置权限<br />
chgrp root /opt/httpd-2.2.9/bin/suexec<br />
chmod 4751 /opt/httpd-2.2.9/bin/suexec<br />
chown www:www -R /home/www<br />
chmod 755 -R /home/www<br />
chmod 700 -R /home/www/php-cgi/php-cgi</p>
<p>8、重启<br />
server httpd restart</p>
<p>9、如果你能看到成功页面，然后就传一个PHP木马上去测试一下权限和安全的问题.<br />
如果连启动都启动不了，那就得查httpd的error_log ，suexec_log，然后去google一下，看看是哪的权限问题。</p>
<p>总结：本人教懒，整个过程调通后，也没写文档，但看到网上此类资料不多，而且有一些都没有命中要害，比如一些权限的配置和相对详尽的说明。我的注释只是把一些网上没有的解释而我弄明白后的理解写在了上边，但真正要想明白，估计还得搬着手册和google去一条条查。而且，我不是边做边写的，而是根据原来的配置盲写了一遍，估计会不少错误，总比没有强。如果有谁发现这个安全依然有问题，可以帮我提出，因为在安全方面我对自己要求很高。<br />
如果有什么需要讨论的，可以加入这个MSN群 lampper@live.cn （加为msn好友即可）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/08/linux_apache_php_mysql_fcgid_suexec_%e9%ab%98%e6%95%88%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%e6%96%b9%e6%a1%88.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP缓存组件APC简介</title>
		<link>http://www.sunboyu.cn/2008/10/03/php%e7%bc%93%e5%ad%98%e7%bb%84%e4%bb%b6apc%e7%ae%80%e4%bb%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/03/php%e7%bc%93%e5%ad%98%e7%bb%84%e4%bb%b6apc%e7%ae%80%e4%bb%8b.shtml#comments</comments>
		<pubDate>Fri, 03 Oct 2008 02:55:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=332</guid>
		<description><![CDATA[php是解释型语言,比起编译型语言,速度自然会慢.每种语言基本都是 1、源代码-&#62;编译成二进制机器码 2、编译成二进制机器码-&#62;执行 编译型语言（如c，java）在执行一次步骤1后，多次执行步骤2，而asp，php之类的解释型语言每次访问，都重复步骤1，2，故效率低下。
PHP官方提供了一个编译php为二进制码的工具，Zend，价格昂贵，今天讨论免费的APC。
APC组件下载地址：http://pecl4win.php.net/ext.php/php_apc.dll  http://pecl.php.net/package/apc  根据自己的操作系统版本来下载安装。我这里使用的是windows系统，直接把php_apc.dll放在扩展文件路径里，在php.ini里增加extension=php_apc.dll，再查看phpinfo(),可看到apc安装成功的信息。具体配置信息在这里  http://cn2.php.net/manual/en/apc.configuration.php
其中的参数可以设定是否缓存php的编译文件，还有一些常用的限制。
除此之外，还有很多opcode缓存组件，如accelerator,xcache之类，详情可参见这里 http://en.wikipedia.org/wiki/Alternative_PHP_Cache#Alternative_PHP_Cache
]]></description>
			<content:encoded><![CDATA[<p>php是解释型语言,比起编译型语言,速度自然会慢.每种语言基本都是 1、源代码-&gt;编译成二进制机器码 2、编译成二进制机器码-&gt;执行 编译型语言（如c，java）在执行一次步骤1后，多次执行步骤2，而asp，php之类的解释型语言每次访问，都重复步骤1，2，故效率低下。</p>
<p>PHP官方提供了一个编译php为二进制码的工具，Zend，价格昂贵，今天讨论免费的APC。</p>
<p>APC组件下载地址：http://pecl4win.php.net/ext.php/php_apc.dll  http://pecl.php.net/package/apc  根据自己的操作系统版本来下载安装。我这里使用的是windows系统，直接把php_apc.dll放在扩展文件路径里，在php.ini里增加extension=php_apc.dll，再查看phpinfo(),可看到apc安装成功的信息。具体配置信息在这里  http://cn2.php.net/manual/en/apc.configuration.php</p>
<p>其中的参数可以设定是否缓存php的编译文件，还有一些常用的限制。</p>
<p>除此之外，还有很多opcode缓存组件，如accelerator,xcache之类，详情可参见这里 http://en.wikipedia.org/wiki/Alternative_PHP_Cache#Alternative_PHP_Cache</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/03/php%e7%bc%93%e5%ad%98%e7%bb%84%e4%bb%b6apc%e7%ae%80%e4%bb%8b.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smarty被PHP抛弃，还是Smarty要走自己的路？</title>
		<link>http://www.sunboyu.cn/2008/09/04/smarty%e8%a2%abphp%e6%8a%9b%e5%bc%83%ef%bc%8c%e8%bf%98%e6%98%afsmarty%e8%a6%81%e8%b5%b0%e8%87%aa%e5%b7%b1%e7%9a%84%e8%b7%af%ef%bc%9f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/04/smarty%e8%a2%abphp%e6%8a%9b%e5%bc%83%ef%bc%8c%e8%bf%98%e6%98%afsmarty%e8%a6%81%e8%b5%b0%e8%87%aa%e5%b7%b1%e7%9a%84%e8%b7%af%ef%bc%9f.shtml#comments</comments>
		<pubDate>Thu, 04 Sep 2008 03:12:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[纯属蛋疼]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=298</guid>
		<description><![CDATA[打开     http://smarty.php.net/
发现只剩下了这样的字

Smarty has moved
Smarty is no longer a subproject of the PHP project, and has subsequently  moved to its own domain: www.smarty.net
]]></description>
			<content:encoded><![CDATA[<p>打开     http://smarty.php.net/</p>
<p>发现只剩下了这样的字</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/09/e69caae591bde5908d.bmp"><img class="aligncenter size-full wp-image-299" title="e69caae591bde5908d" src="http://www.sunboyu.cn/upfiles/2008/09/e69caae591bde5908d.bmp" alt="" /></a></p>
<p>Smarty has moved</p>
<h2>Smarty is no longer a subproject of the PHP project, and has subsequently  moved to its own domain: <a href="http://www.smarty.net/">www.smarty.net</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/04/smarty%e8%a2%abphp%e6%8a%9b%e5%bc%83%ef%bc%8c%e8%bf%98%e6%98%afsmarty%e8%a6%81%e8%b5%b0%e8%87%aa%e5%b7%b1%e7%9a%84%e8%b7%af%ef%bc%9f.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP中FTP模块的一些应用</title>
		<link>http://www.sunboyu.cn/2008/08/27/php%e4%b8%adftp%e6%a8%a1%e5%9d%97%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/27/php%e4%b8%adftp%e6%a8%a1%e5%9d%97%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Wed, 27 Aug 2008 02:20:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=288</guid>
		<description><![CDATA[&#60;?php
class ftp
{
	//connect id
	var $ftp;
	//remote dir
	var $remotedir = '/';
	//local dir
	var $localdir = './';
	//write log
	var $writelog = false;
	//log file
	var $logfile = 'ftp_log.txt';
	//print log
	var $printlog = false;
	//session time
	var $timeout = 60;
	//construct connetc
	function __construct( $host , $user , $pass )
	{
		$this-&#62;ftp = @ftp_connect( $host );
		ftp_login( $this-&#62;ftp, $user , $pass );
		//ftp_set_option( $this-&#62;ftp , FTP_TIMEOUT_SEC , $this-&#62;timeout );
	}
	//list sub files
	function __list( $dir [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt;?php</li>
<li>class ftp</li>
<li>{</li>
<li>	//connect id</li>
<li>	var $ftp;</li>
<li>	//remote dir</li>
<li>	var $remotedir = '/';</li>
<li>	//local dir</li>
<li>	var $localdir = './';</li>
<li>	//write log</li>
<li>	var $writelog = false;</li>
<li>	//log file</li>
<li>	var $logfile = 'ftp_log.txt';</li>
<li>	//print log</li>
<li>	var $printlog = false;</li>
<li>	//session time</li>
<li>	var $timeout = 60;</li>
<li>	//construct connetc</li>
<li>	function __construct( $host , $user , $pass )</li>
<li>	{</li>
<li>		$this-&gt;ftp = @ftp_connect( $host );</li>
<li>		ftp_login( $this-&gt;ftp, $user , $pass );</li>
<li>		//ftp_set_option( $this-&gt;ftp , FTP_TIMEOUT_SEC , $this-&gt;timeout );</li>
<li>	}</li>
<li>	//list sub files</li>
<li>	function __list( $dir = false , $subtree = false )</li>
<li>	{</li>
<li>		$rlist = array();</li>
<li>		if(!$dir)</li>
<li>		{</li>
<li>			$dir = $this-&gt;remotedir;</li>
<li>		}</li>
<li>		$list = ftp_rawlist($this-&gt;ftp,$dir,TRUE);</li>
<li>		if(is_array($list))</li>
<li>		{</li>
<li>			foreach( $list as $key =&gt; $value )</li>
<li>			{</li>
<li>				$tmp = explode( ' ' , $value );</li>
<li>				$rlist[$key] = end($tmp);</li>
<li>				if(@ftp_chdir($this-&gt;ftp,$dir.$rlist[$key].'/'))</li>
<li>				{</li>
<li>					$rlist[$rlist[$key]] = $this-&gt;__list( $dir.$rlist[$key].'/' );</li>
<li>					unset($rlist[$key]);</li>
<li>				}</li>
<li>				unset($tmp);</li>
<li>			}</li>
<li>		}</li>
<li>		return $rlist;</li>
<li>	}</li>
<li>	//change dir&nbsp; $isabs = false,use rela dir default</li>
<li>	function __chdir( $dir , $isabs = false )</li>
<li>	{</li>
<li>		if(!$isabs)</li>
<li>		{</li>
<li>			$nextdir = $this-&gt;remotedir.$dir.'/';</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			$nextdir = $dir;</li>
<li>		}</li>
<li>		if(ftp_chdir($this-&gt;ftp,$nextdir))</li>
<li>		{</li>
<li>			$this-&gt;remotedir = $nextdir;</li>
<li>			return true;</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			return false;</li>
<li>		}</li>
<li>	}</li>
<li>	//close connect</li>
<li>	function __close()</li>
<li>	{</li>
<li>		@ftp_close($this-&gt;ftp);</li>
<li>	}</li>
<li>}</li>
<li>$ftp = new ftp( 'www.sunboyu.cn' , '**', '***' );</li>
<li>$ftp-&gt;__chdir('website',0);</li>
<li>$list = $ftp-&gt;__list('/');</li>
<li>echo $a = time();</li>
<li>print_r($list);</li>
<li>echo time() - $a;</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/27/php%e4%b8%adftp%e6%a8%a1%e5%9d%97%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP调用COM获得服务器硬件信息</title>
		<link>http://www.sunboyu.cn/2008/08/24/php%e8%b0%83%e7%94%a8com%e8%8e%b7%e5%be%97%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a1%ac%e4%bb%b6%e4%bf%a1%e6%81%af.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/24/php%e8%b0%83%e7%94%a8com%e8%8e%b7%e5%be%97%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a1%ac%e4%bb%b6%e4%bf%a1%e6%81%af.shtml#comments</comments>
		<pubDate>Sun, 24 Aug 2008 02:23:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[技术存档]]></category>
		<category><![CDATA[com]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=285</guid>
		<description><![CDATA[function sys_windows() {
	$objLocator = new COM(&#34;WbemScripting.SWbemLocator&#34;);
	$wmi = $objLocator-&#62;ConnectServer();
	$prop = $wmi-&#62;get(&#34;Win32_PnPEntity&#34;);
	//CPU
	$cpuinfo = GetWMI($wmi,&#34;Win32_Processor&#34;, array(&#34;Name&#34;,&#34;L2CacheSize&#34;,&#34;NumberOfCores&#34;));
	$res['CPU个数'] = $cpuinfo[0]['NumberOfCores'];
	if (null == $res['CPU个数']) {
		$res['CPU个数'] = 1;
	}
	for ($i=0;$i&#60;$res['cpu']['num'];$i++){
		$res['CPU型号'] .= $cpuinfo[0]['Name'].&#34;&#60;br&#62;&#34;;
		$res['二级缓存'] .= $cpuinfo[0]['L2CacheSize'].&#34;&#60;br&#62;&#34;;
	}
	// SYSINFO
	$sysinfo = GetWMI($wmi,&#34;Win32_OperatingSystem&#34;, array('LastBootUpTime','TotalVisibleMemorySize','FreePhysicalMemory','Caption','CSDVersion','SerialNumber','InstallDate'));
	$res['操作系统版本'] = $sysinfo[0]['Caption'].&#34; &#34;.$sysinfo[0]['CSDVersion'];
	$res['操作系统序列号'] = &#34;{$sysinfo[0]['SerialNumber']} 于&#34;.date('Y年m月d日H:i:s',strtotime(substr($sysinfo[0]['InstallDate'],0,14))).&#34;安装&#34;;
	//UPTIME
	$res['最后重启时间'] = $sysinfo[0]['LastBootUpTime'];
&#160;
&#160;
	$sys_ticks = 3600*8 + time() - strtotime(substr($res['最后重启时间'],0,14));
	$min = $sys_ticks / 60;
	$hours = $min / 60;
	$days = floor($hours / [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">function sys_windows() {</li>
<li>	$objLocator = new COM(&quot;WbemScripting.SWbemLocator&quot;);</li>
<li>	$wmi = $objLocator-&gt;ConnectServer();</li>
<li>	$prop = $wmi-&gt;get(&quot;Win32_PnPEntity&quot;);</li>
<li>	//CPU</li>
<li>	$cpuinfo = GetWMI($wmi,&quot;Win32_Processor&quot;, array(&quot;Name&quot;,&quot;L2CacheSize&quot;,&quot;NumberOfCores&quot;));</li>
<li>	$res['CPU个数'] = $cpuinfo[0]['NumberOfCores'];</li>
<li>	if (null == $res['CPU个数']) {</li>
<li>		$res['CPU个数'] = 1;</li>
<li>	}</li>
<li>	for ($i=0;$i&lt;$res['cpu']['num'];$i++){</li>
<li>		$res['CPU型号'] .= $cpuinfo[0]['Name'].&quot;&lt;br&gt;&quot;;</li>
<li>		$res['二级缓存'] .= $cpuinfo[0]['L2CacheSize'].&quot;&lt;br&gt;&quot;;</li>
<li>	}</li>
<li>	// SYSINFO</li>
<li>	$sysinfo = GetWMI($wmi,&quot;Win32_OperatingSystem&quot;, array('LastBootUpTime','TotalVisibleMemorySize','FreePhysicalMemory','Caption','CSDVersion','SerialNumber','InstallDate'));</li>
<li>	$res['操作系统版本'] = $sysinfo[0]['Caption'].&quot; &quot;.$sysinfo[0]['CSDVersion'];</li>
<li>	$res['操作系统序列号'] = &quot;{$sysinfo[0]['SerialNumber']} 于&quot;.date('Y年m月d日H:i:s',strtotime(substr($sysinfo[0]['InstallDate'],0,14))).&quot;安装&quot;;</li>
<li>	//UPTIME</li>
<li>	$res['最后重启时间'] = $sysinfo[0]['LastBootUpTime'];</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>	$sys_ticks = 3600*8 + time() - strtotime(substr($res['最后重启时间'],0,14));</li>
<li>	$min = $sys_ticks / 60;</li>
<li>	$hours = $min / 60;</li>
<li>	$days = floor($hours / 24);</li>
<li>	$hours = floor($hours - ($days * 24));</li>
<li>	$min = floor($min - ($days * 60 * 24) - ($hours * 60));</li>
<li>	if ($days !== 0) $ress['day'] = $days.&quot;天&quot;;</li>
<li>	if ($hours !== 0) $ress['hours'] .= $hours.&quot;小时&quot;;</li>
<li>	$res['最后重启时间'] = $ress['day'].$ress['hours'].$min.&quot;分钟&quot;;</li>
<li>&nbsp;</li>
<li>	//MEMORY</li>
<li>	$res['物理内存'] = $sysinfo[0]['TotalVisibleMemorySize'];</li>
<li>	$res['剩余内存'] = $sysinfo[0]['FreePhysicalMemory'];</li>
<li>	$res['已使用内存'] = $res['物理内存'] - $res['剩余内存'];</li>
<li>	$res['使用率'] = round($res['已使用内存'] / $res['物理内存']*100,2);</li>
<li>&nbsp;</li>
<li>	$swapinfo = GetWMI($wmi,&quot;Win32_PageFileUsage&quot;, array('AllocatedBaseSize','CurrentUsage'));</li>
<li>&nbsp;</li>
<li>	// TODO swp区获取</li>
<li>	$res['交换分区'] = $swapinfo[0][AllocatedBaseSize];</li>
<li>	$res['已经使用'] = $swapinfo[0][CurrentUsage];</li>
<li>	$res['剩余内存'] = $res['swapTotal'] - $res['swapUsed'];</li>
<li>	$res['使用率'] = (floatval($res['swapTotal'])!=0)?round($res['swapUsed']/$res['swapTotal']*100,2):0;</li>
<li>&nbsp;</li>
<li>	// LoadPercentage</li>
<li>	$loadinfo = GetWMI($wmi,&quot;Win32_Processor&quot;, array(&quot;LoadPercentage&quot;));</li>
<li>	$res['系统平均负载'] = $loadinfo[0]['LoadPercentage'];</li>
<li>&nbsp;</li>
<li>	return $res;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function GetWMI($wmi,$strClass, $strValue = array()) {</li>
<li>	$arrData = array();</li>
<li>&nbsp;</li>
<li>	$objWEBM = $wmi-&gt;Get($strClass);</li>
<li>	$arrProp = $objWEBM-&gt;Properties_;</li>
<li>	$arrWEBMCol = $objWEBM-&gt;Instances_();</li>
<li>	foreach($arrWEBMCol as $objItem) {</li>
<li>		@reset($arrProp);</li>
<li>		$arrInstance = array();</li>
<li>		foreach($arrProp as $propItem) {</li>
<li>			eval(&quot;\$value = \$objItem-&gt;&quot; . $propItem-&gt;Name . &quot;;&quot;);</li>
<li>			if (empty($strValue)) {</li>
<li>				$arrInstance[$propItem-&gt;Name] = trim($value);</li>
<li>			} else {</li>
<li>				if (in_array($propItem-&gt;Name, $strValue)) {</li>
<li>					$arrInstance[$propItem-&gt;Name] = trim($value);</li>
<li>				}</li>
<li>			}</li>
<li>		}</li>
<li>		$arrData[] = $arrInstance;</li>
<li>	}</li>
<li>	return $arrData;</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/24/php%e8%b0%83%e7%94%a8com%e8%8e%b7%e5%be%97%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%a1%ac%e4%bb%b6%e4%bf%a1%e6%81%af.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用mysql保存session，并建立在线用户列表</title>
		<link>http://www.sunboyu.cn/2008/08/15/%e4%bd%bf%e7%94%a8mysql%e4%bf%9d%e5%ad%98session%ef%bc%8c%e5%b9%b6%e5%bb%ba%e7%ab%8b%e5%9c%a8%e7%ba%bf%e7%94%a8%e6%88%b7%e5%88%97%e8%a1%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/15/%e4%bd%bf%e7%94%a8mysql%e4%bf%9d%e5%ad%98session%ef%bc%8c%e5%b9%b6%e5%bb%ba%e7%ab%8b%e5%9c%a8%e7%ba%bf%e7%94%a8%e6%88%b7%e5%88%97%e8%a1%a8.shtml#comments</comments>
		<pubDate>Fri, 15 Aug 2008 15:02:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=280</guid>
		<description><![CDATA[写OA，使用mysql存储session，这样，是为了获得在线用户的列表，为做一个web im做准备。
首先创建表,注，这里使用了adodb中数据字典的描述方法：
$Session_Fields = &#34;
session_id VARCHAR(100) NOTNULL,
session_value X DEFAULT '',
session_expires I(10) DEFAULT NULL,
userid I(5) DEFAULT NULL
&#34;;
$Session_Tables = array('mysql' =&#62; &#34;ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT = 'session表'&#34;);
$dict = NewDataDictionary(GetDB());
$sqlarray = $dict-&#62;CreateTableSQL($_CFG['table']['session'], $Session_Fields, $Session_Tables);
$dict-&#62;ExecuteSQLArray($sqlarray);
然后session类:
&#60;?php
/*&#160; Session.Class.php
&#160;*&#160; Session Manager
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2008 08 14&#160; sunboyu@gmail.com
&#160;*/
class Session
{
	var $lifetime;
	var [...]]]></description>
			<content:encoded><![CDATA[<p>写OA，使用mysql存储session，这样，是为了获得在线用户的列表，为做一个web im做准备。</p>
<p>首先创建表,注，这里使用了adodb中数据字典的描述方法：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">$Session_Fields = &quot;</li>
<li>session_id VARCHAR(100) NOTNULL,</li>
<li>session_value X DEFAULT '',</li>
<li>session_expires I(10) DEFAULT NULL,</li>
<li>userid I(5) DEFAULT NULL</li>
<li>&quot;;</li>
<li>$Session_Tables = array('mysql' =&gt; &quot;ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT = 'session表'&quot;);</li>
<li>$dict = NewDataDictionary(GetDB());</li>
<li>$sqlarray = $dict-&gt;CreateTableSQL($_CFG['table']['session'], $Session_Fields, $Session_Tables);</li>
<li>$dict-&gt;ExecuteSQLArray($sqlarray);</li></ol></div>
<p>然后session类:</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt;?php</li>
<li>/*&nbsp; Session.Class.php</li>
<li>&nbsp;*&nbsp; Session Manager</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 14&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*/</li>
<li>class Session</li>
<li>{</li>
<li>	var $lifetime;</li>
<li>	var $db = null;</li>
<li>	function __construct()</li>
<li>	{	</li>
<li>		#return adodb lite connetction</li>
<li>		$this-&gt;db = GetDB();</li>
<li>	}</li>
<li>	#open</li>
<li>	function open( $savepath , $session_name )</li>
<li>	{</li>
<li>		$this-&gt;lifetime =&nbsp; get_cfg_var(&quot;session.gc_maxlifetime&quot;);</li>
<li>		return true;</li>
<li>	}</li>
<li>	#close</li>
<li>	function close()</li>
<li>	{</li>
<li>		return true;</li>
<li>	}</li>
<li>	#read</li>
<li>	function read( $session_id )</li>
<li>	{</li>
<li>		global $_CFG;</li>
<li>		$sql = sprintf(&quot;SELECT * FROM %s WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString( $session_id ));</li>
<li>		$rs = $this-&gt;db-&gt;Execute( $sql );</li>
<li>		if($rs-&gt;RecordCount()&gt;0)</li>
<li>		{</li>
<li>			$result = $rs-&gt;fields;</li>
<li>			</li>
<li>			return $result['session_value'];</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			return null;</li>
<li>		}</li>
<li>	}</li>
<li>	#write</li>
<li>	function write( $session_id , $session_value )</li>
<li>	{</li>
<li>		global $_CFG;</li>
<li>		$sql = sprintf(&quot;SELECT session_id FROM %s WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString( $session_id ));</li>
<li>		$rs = $this-&gt;db-&gt;Execute( $sql );</li>
<li>		if($rs-&gt;RecordCount()==0)</li>
<li>		{</li>
<li>			$newsql = sprintf(&quot;INSERT INTO %s SET session_id = %s , session_value = %s , session_expires = %d&quot;,</li>
<li>				$_CFG['table']['session'],</li>
<li>				GetSqlString( $session_id ),</li>
<li>				GetSqlString( $session_value ),</li>
<li>				GetSqlString( $this-&gt;lifetime+time() , &quot;int&quot; ));</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			$newsql = sprintf(&quot;UPDATE %s SET session_value = %s , session_expires = %d WHERE session_id = %s&quot;,</li>
<li>				$_CFG['table']['session'],</li>
<li>				GetSqlString( $session_value ),</li>
<li>				GetSqlString( $this-&gt;lifetime+time() , &quot;int&quot; ),</li>
<li>				GetSqlString( $session_id ));</li>
<li>		}</li>
<li>		return $this-&gt;db-&gt;Execute( $newsql );</li>
<li>	}</li>
<li>	#destroy</li>
<li>	function destroy( $session_id )</li>
<li>	{	</li>
<li>		global $_CFG;</li>
<li>		$delsql = sprintf(&quot;DELETE FROM %s WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString( $session_id ));</li>
<li>		return $this-&gt;db-&gt;Execute( $delsql );</li>
<li>	}</li>
<li>	#gc</li>
<li>	function gc()</li>
<li>	{</li>
<li>		 global $_CFG;</li>
<li>		 $gcsql = sprintf(&quot;DELETE FROM %s WHERE session_expires &lt; %d&quot;,$_CFG['table']['session'],time());</li>
<li>		 return $this-&gt;db-&gt;Execute( $gcsql );</li>
<li>	}</li>
<li>}</li>
<li>?&gt;</li></ol></div>
<p>session机制，之前已经介绍，实现代码如下</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">$session = new Session();</li>
<li>	session_set_save_handler(array(&amp;$session,&quot;open&quot;),</li>
<li>							 array(&amp;$session,&quot;close&quot;),</li>
<li>							 array(&amp;$session,&quot;read&quot;),</li>
<li>							 array(&amp;$session,&quot;write&quot;),</li>
<li>							 array(&amp;$session,&quot;destroy&quot;),</li>
<li>							 array(&amp;$session,&quot;gc&quot;));</li>
<li>	session_start();</li></ol></div>
<p>把session与用户id对应，使用以下语句即可</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">sprintf(&quot;UPDATE %s SET userid = %d WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString($rs['id'],'int'),GetSqlString(session_id(),'text'))</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/15/%e4%bd%bf%e7%94%a8mysql%e4%bf%9d%e5%ad%98session%ef%bc%8c%e5%b9%b6%e5%bb%ba%e7%ab%8b%e5%9c%a8%e7%ba%bf%e7%94%a8%e6%88%b7%e5%88%97%e8%a1%a8.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>腾讯公司的PHP面试题，看你能拿多少分</title>
		<link>http://www.sunboyu.cn/2008/08/08/%e8%85%be%e8%ae%af%e5%85%ac%e5%8f%b8%e7%9a%84php%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%8c%e7%9c%8b%e4%bd%a0%e8%83%bd%e6%8b%bf%e5%a4%9a%e5%b0%91%e5%88%86.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/08/%e8%85%be%e8%ae%af%e5%85%ac%e5%8f%b8%e7%9a%84php%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%8c%e7%9c%8b%e4%bd%a0%e8%83%bd%e6%8b%bf%e5%a4%9a%e5%b0%91%e5%88%86.shtml#comments</comments>
		<pubDate>Fri, 08 Aug 2008 07:14:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[相当拍砖]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qq]]></category>
		<category><![CDATA[面试]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=256</guid>
		<description><![CDATA[腾讯公司的PHP面试题
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/08/e885bee8aeafe79a84phpe99da2e8af95e9a2981.txt">腾讯公司的PHP面试题</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/08/%e8%85%be%e8%ae%af%e5%85%ac%e5%8f%b8%e7%9a%84php%e9%9d%a2%e8%af%95%e9%a2%98%ef%bc%8c%e7%9c%8b%e4%bd%a0%e8%83%bd%e6%8b%bf%e5%a4%9a%e5%b0%91%e5%88%86.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>40 Tips for optimizing your php code</title>
		<link>http://www.sunboyu.cn/2008/08/05/40-tips-for-optimizing-your-php-code.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/05/40-tips-for-optimizing-your-php-code.shtml#comments</comments>
		<pubDate>Tue, 05 Aug 2008 02:22:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[技术存档]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=244</guid>
		<description><![CDATA[
If a method can be static, declare it static. Speed improvement is by a factor of 4.
echo is faster than print.
Use echo&#8217;s multiple parameters instead of string concatenation.
Set the maxvalue for your for-loops before and not in the loop.
Unset your variables to free memory, especially large arrays.
Avoid magic like __get, __set, __autoload
require_once() is expensive
Use full [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>If a method can be static, declare it static. Speed improvement is by a factor of 4.</li>
<li><em>echo</em> is faster than <em>print</em>.</li>
<li>Use echo&#8217;s multiple parameters instead of string concatenation.</li>
<li>Set the maxvalue for your for-loops before and not in the loop.</li>
<li>Unset your variables to free memory, especially large arrays.</li>
<li>Avoid magic like __get, __set, __autoload</li>
<li>require_once() is expensive</li>
<li>Use full paths in includes and requires, less time spent on resolving the OS paths.</li>
<li>If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()</li>
<li>See if you can use strncasecmp, strpbrk and stripos instead of regex</li>
<li>str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4</li>
<li>If the function, such as string replacement function, accepts both arrays and single characters as arguments, and if your argument list is not too long, consider writing a few redundant replacement statements, passing one character at a time, instead of one line of code that accepts arrays as search and replace arguments.</li>
<li>It&#8217;s better to use switch statements than multi if, else if, statements.</li>
<li>Error suppression with @ is very slow.</li>
<li>Turn on apache&#8217;s mod_deflate</li>
<li>Close your database connections when you&#8217;re done with them</li>
<li>$row[’id’] is 7 times faster than $row[id]</li>
<li>Error messages are expensive</li>
<li>Do not use functions inside of for loop, such as for ($x=0; $x &lt; count($array); $x) The count() function gets called each time.</li>
<li>Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.</li>
<li>Incrementing a global variable is 2 times slow than a local var.</li>
<li>Incrementing an object property (eg. $this-&gt;prop++) is 3 times slower than a local variable.</li>
<li>Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one.</li>
<li>Just declaring a global variable without using it in a function also slows things down (by about the same amount as incrementing a local var). PHP probably does a check to see if the global exists.</li>
<li>Method invocation appears to be independent of the number of methods defined in the class because I added 10 more methods to the test class (before and after the test method) with no change in performance.</li>
<li>Methods in derived classes run faster than ones defined in the base class.</li>
<li>A function call with one parameter and an empty function body takes about the same time as doing 7-8 $localvar++ operations. A similar method call is of course about 15 $localvar++ operations.</li>
<li>Surrounding your string by &#8216; instead of &#8221; will make things interpret a little faster since php looks for variables inside &#8220;&#8230;&#8221; but not inside &#8216;&#8230;&#8217;. Of course you can only do this when you don&#8217;t need to have variables in the string.</li>
<li>When echoing strings it&#8217;s faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments.</li>
<li>A PHP script will be served at least 2-10 times slower than a static HTML page by Apache. Try to use more static HTML pages and fewer scripts.</li>
<li>Your PHP scripts are recompiled every time unless the scripts are cached. Install a PHP caching product to typically increase performance by 25-100% by removing compile times.</li>
<li>Cache as much as possible. Use memcached &#8211; memcached is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. OP code caches are useful so that your script does not have to be compiled on every request</li>
<li>When working with strings and you need to check that the string is either of a certain length you&#8217;d understandably would want to use the strlen() function. This function is pretty quick since it&#8217;s operation does not perform any calculation but merely return the already known length of a string available in the zval structure (internal C struct used to store variables in PHP). However because strlen() is a function it is still somewhat slow because the function call requires several operations such as lowercase &amp; hashtable lookup followed by the execution of said function. In some instance you can improve the speed of your code by using an isset() trick.Ex.if (strlen($foo) &lt; 5) { echo &#8220;Foo is too short&#8221;; }
<p>vs.</p>
<p>if (!isset($foo{5})) { echo &#8220;Foo is too short&#8221;; }</p>
<p>Calling isset() happens to be faster then strlen() because unlike strlen(), isset() is a language construct and not a function meaning that it&#8217;s execution does not require function lookups and lowercase. This means you have virtually no overhead on top of the actual code that determines the string&#8217;s length.</li>
<li>When incrementing or decrementing the value of the variable $i++ happens to be a tad slower then ++$i. This is something PHP specific and does not apply to other languages, so don&#8217;t go modifying your C or Java code thinking it&#8217;ll suddenly become faster, it won&#8217;t. ++$i happens to be faster in PHP because instead of 4 opcodes used for $i++ you only need 3. Post incrementation actually causes in the creation of a temporary var that is then incremented. While pre-incrementation increases the original value directly. This is one of the optimization that opcode optimized like Zend&#8217;s PHP optimizer. It is a still a good idea to keep in mind since not all opcode optimizers perform this optimization and there are plenty of ISPs and servers running without an opcode optimizer.</li>
<li>Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory.</li>
<li>Do not implement every data structure as a class, arrays are useful, too</li>
<li>Don&#8217;t split methods too much, think, which code you will really re-use</li>
<li>You can always split the code of a method later, when needed</li>
<li>Make use of the countless predefined functions</li>
<li>If you have very time consuming functions in your code, consider writing them as C extensions</li>
<li>Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview</li>
<li>mod_gzip which is available as an Apache module compresses your data on the fly and can reduce the data to transfer up to 80%</li>
<li>Excellent Article about optimizing php by John Lim</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/05/40-tips-for-optimizing-your-php-code.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>在windows在安装FreeTDS，让mssql支持UTF-8</title>
		<link>http://www.sunboyu.cn/2008/07/22/%e5%9c%a8windows%e5%9c%a8%e5%ae%89%e8%a3%85freetds%ef%bc%8c%e8%ae%a9mssql%e6%94%af%e6%8c%81utf-8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/22/%e5%9c%a8windows%e5%9c%a8%e5%ae%89%e8%a3%85freetds%ef%bc%8c%e8%ae%a9mssql%e6%94%af%e6%8c%81utf-8.shtml#comments</comments>
		<pubDate>Tue, 22 Jul 2008 07:27:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[其他]]></category>
		<category><![CDATA[freetds]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=209</guid>
		<description><![CDATA[本人有个项目使用php+mssql，而mssql只支持gb2312和utf-16编码，而php又要求使用utf-8编码，想到了freetds.而freetds是个在unix下开发的工具，我下载freetds最新版后，发现里边有windows下的编译脚本，在DEV-C++里进行编译后，不支持，后又从鬼子论坛里找到达人编译好的组件，安装配置后，正常，大喜。
; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
mssql.charset = &#8220;UTF-8&#8243;
在php.ini里设置这里，即可让FreeTDS生效。This is only used when compiled with FreeTDS。mssql默认是不支持设置字符集的，只有安装freetds的时候才能生效。
其实，PHP官方早就在系统里留出了freetds的接口，windows下的PHP.INI文件就为freetds留出接口参数。
在linux下，编译php的时候，有这样的日志
configure:68696: checking whether to enable pcntl support
configure:69264: checking whether to enable PDO support
configure:69689: checking for PDO_DBLIB support via FreeTDS
configure:70399: checking for Firebird [...]]]></description>
			<content:encoded><![CDATA[<p>本人有个项目使用php+mssql，而mssql只支持gb2312和utf-16编码，而php又要求使用utf-8编码，想到了freetds.而freetds是个在unix下开发的工具，我下载freetds最新版后，发现里边有windows下的编译脚本，在DEV-C++里进行编译后，不支持，后又从鬼子论坛里找到达人编译好的组件，安装配置后，正常，大喜。</p>
<p>; Specify client character set.<br />
; If empty or not set the client charset from freetds.comf is used<br />
; This is only used when compiled with FreeTDS<br />
mssql.charset = &#8220;UTF-8&#8243;</p>
<p>在php.ini里设置这里，即可让FreeTDS生效。This is only used when compiled with FreeTDS。mssql默认是不支持设置字符集的，只有安装freetds的时候才能生效。</p>
<p>其实，PHP官方早就在系统里留出了freetds的接口，windows下的PHP.INI文件就为freetds留出接口参数。</p>
<p>在linux下，编译php的时候，有这样的日志</p>
<p>configure:68696: checking whether to enable pcntl support<br />
configure:69264: checking whether to enable PDO support<br />
configure:69689: checking for PDO_DBLIB support via FreeTDS<br />
configure:70399: checking for Firebird support for PDO</p>
<p>在linux下，同样为php留出了接口</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/22/%e5%9c%a8windows%e5%9c%a8%e5%ae%89%e8%a3%85freetds%ef%bc%8c%e8%ae%a9mssql%e6%94%af%e6%8c%81utf-8.shtml/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>打造全能优化的Linux+Apache+PHP+Mysql服务器（1）</title>
		<link>http://www.sunboyu.cn/2008/07/13/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%881%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/13/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%881%ef%bc%89.shtml#comments</comments>
		<pubDate>Sun, 13 Jul 2008 13:05:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[APACHE]]></category>
		<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[服务器]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=196</guid>
		<description><![CDATA[fastcgi   http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
apache2   http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz
mysql5    http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51b.tar.gz/from/http://mysql.mirrors.arminco.com/
php5      http://cn2.php.net/distributions/php-5.2.6.tar.gz
libxml2
gd-jpeg   ftp://192.48.96.9/graphics/jpeg/jpegsrc.v6b.tar.gz
freetype  http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.7.tar.gz
libpng    http://voxel.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.29.tar.gz
zend      http://www.zend.com/download/55
memcached  http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz
memcache   http://pecl.php.net/get/memcache-3.0.1.tgz
libevent   http://www.monkey.org/~provos/libevent-1.2a.tar.gz
目前想到的功能大概有这些，想到再加。
目前正在研究每一个组件的性能和参数。
]]></description>
			<content:encoded><![CDATA[<p>fastcgi   http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz<br />
apache2   http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz<br />
mysql5    http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51b.tar.gz/from/http://mysql.mirrors.arminco.com/<br />
php5      http://cn2.php.net/distributions/php-5.2.6.tar.gz<br />
libxml2<br />
gd-jpeg   ftp://192.48.96.9/graphics/jpeg/jpegsrc.v6b.tar.gz<br />
freetype  http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.7.tar.gz<br />
libpng    http://voxel.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.29.tar.gz<br />
zend      http://www.zend.com/download/55</p>
<p>memcached  http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz<br />
memcache   http://pecl.php.net/get/memcache-3.0.1.tgz<br />
libevent   http://www.monkey.org/~provos/libevent-1.2a.tar.gz</p>
<p>目前想到的功能大概有这些，想到再加。</p>
<p>目前正在研究每一个组件的性能和参数。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/13/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%881%ef%bc%89.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>学编程，重在基本素质</title>
		<link>http://www.sunboyu.cn/2008/07/10/%e5%ad%a6%e7%bc%96%e7%a8%8b%ef%bc%8c%e9%87%8d%e5%9c%a8%e5%9f%ba%e6%9c%ac%e7%b4%a0%e8%b4%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/10/%e5%ad%a6%e7%bc%96%e7%a8%8b%ef%bc%8c%e9%87%8d%e5%9c%a8%e5%9f%ba%e6%9c%ac%e7%b4%a0%e8%b4%a8.shtml#comments</comments>
		<pubDate>Thu, 10 Jul 2008 01:30:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[感悟]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[方法]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=188</guid>
		<description><![CDATA[最近总有朋友问我，国内有什么比较简单的PHP书籍，怎么学习PHP，有啥捷径，还有的说，二哥，给个小程序学学……
我一般都会说，没捷径，没好书，想学程序，去下一些外国的开源，比我的好得多。
其实，我也是从问那些问题过来的，不过，我还是想把我的经验分享给大家，希望大家别绕弯子，能走捷径。
学PHP，建议还是有点编程基础，不管是C,VB,VFP。懂点语言基础，就说明能理解一些基本概念。一些函数，变量，逻辑分支，这些是最基础的。有这些基础，再了解B/S结构工作原理，就可以写WEB程序了。
书，我一般当工具书，讲案例的不多，杜江老师那本书凑合，对我来说已经足够，能知道PHP都能干什么，其他的，你可以买本圣经当手册，也可以下个电子版。
程序，建议到站长网或者开源社区下一些小的，学就要学好的，看就要看规范的，看我的只能把你们带坏。先学着改人家的程序，可以改改DEDEcms，可以改一下ECSHOP，可以改改论坛，看看discuz，做个模板等。
看差不多了，可以自己写简单的程序，一般都是留言本（我最近才写过），写个简单的文章发布，足以。
这些都差不多了，可以看一些别人的类库，框架，看看人家是怎么封装一些逻辑过程。
这些你都学差不多了，其实找工作就不难了。别嫌工资少，找个项目，最好能有个好的大哥，拼一段，能力会有很大提高。
作项目，不是单纯做程序，要把一些程序之外的东西揉到程序里，这时候，才是一个有实用价值的程序员。
至于如何提高，我没有啥好的方法。我也不认为我提高多快。我的方法只是：不断敲代码，天天敲代码。
要有高人有啥好的方法，有啥好的课题，可以一起研究。
]]></description>
			<content:encoded><![CDATA[<p>最近总有朋友问我，国内有什么比较简单的PHP书籍，怎么学习PHP，有啥捷径，还有的说，二哥，给个小程序学学……</p>
<p>我一般都会说，没捷径，没好书，想学程序，去下一些外国的开源，比我的好得多。</p>
<p>其实，我也是从问那些问题过来的，不过，我还是想把我的经验分享给大家，希望大家别绕弯子，能走捷径。</p>
<p>学PHP，建议还是有点编程基础，不管是C,VB,VFP。懂点语言基础，就说明能理解一些基本概念。一些函数，变量，逻辑分支，这些是最基础的。有这些基础，再了解B/S结构工作原理，就可以写WEB程序了。</p>
<p>书，我一般当工具书，讲案例的不多，杜江老师那本书凑合，对我来说已经足够，能知道PHP都能干什么，其他的，你可以买本圣经当手册，也可以下个电子版。</p>
<p>程序，建议到站长网或者开源社区下一些小的，学就要学好的，看就要看规范的，看我的只能把你们带坏。先学着改人家的程序，可以改改DEDEcms，可以改一下ECSHOP，可以改改论坛，看看discuz，做个模板等。</p>
<p>看差不多了，可以自己写简单的程序，一般都是留言本（我最近才写过），写个简单的文章发布，足以。</p>
<p>这些都差不多了，可以看一些别人的类库，框架，看看人家是怎么封装一些逻辑过程。</p>
<p>这些你都学差不多了，其实找工作就不难了。别嫌工资少，找个项目，最好能有个好的大哥，拼一段，能力会有很大提高。</p>
<p>作项目，不是单纯做程序，要把一些程序之外的东西揉到程序里，这时候，才是一个有实用价值的程序员。</p>
<p>至于如何提高，我没有啥好的方法。我也不认为我提高多快。我的方法只是：不断敲代码，天天敲代码。</p>
<p>要有高人有啥好的方法，有啥好的课题，可以一起研究。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/10/%e5%ad%a6%e7%bc%96%e7%a8%8b%ef%bc%8c%e9%87%8d%e5%9c%a8%e5%9f%ba%e6%9c%ac%e7%b4%a0%e8%b4%a8.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>程序调式N多招</title>
		<link>http://www.sunboyu.cn/2008/07/08/%e7%a8%8b%e5%ba%8f%e8%b0%83%e5%bc%8fn%e5%a4%9a%e6%8b%9b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/08/%e7%a8%8b%e5%ba%8f%e8%b0%83%e5%bc%8fn%e5%a4%9a%e6%8b%9b.shtml#comments</comments>
		<pubDate>Tue, 08 Jul 2008 12:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[调试]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=184</guid>
		<description><![CDATA[最近在群里扯淡，好多小鸟提的问题其实很简单，程序本身的报错机制就能告诉你错误。现在列出所有能给你提示的方法.

打开PHP的报错。在php.ini(win下)中，寻找  error_reporting   ,设置 error_reporting  =  E_ALL &#38; ~E_NOTICE，好像默认就是这个。
如果还是找不到，那么在你程序的头上加上:error_reporting(2047),这样错误也都会出来。

这两条是程序有硬伤的时候，直接报出来。如果逻辑上的错误，咋调呢？我的方法比较奔，但的确有效。

输入echo &#8220;aaa&#8221;;break; 这样，可以判断出程序是哪里出问题而中断了。
print_r($var);这样去跟踪你认为出错的数据，用肉眼监视＋大脑计算，去对比程序的计算，只要涉及变量值可能改变的地方，都得去对比。

这是程序差错的方法。mysql就更简单了，把你认为有错误的sql语句echo出来，放到phpmyadmin里去执行，看那个报错就行了。
最后一点：下载个星际译王，当然是指英文不太利索的。
]]></description>
			<content:encoded><![CDATA[<p>最近在群里扯淡，好多小鸟提的问题其实很简单，程序本身的报错机制就能告诉你错误。现在列出所有能给你提示的方法.</p>
<ol>
<li>打开PHP的报错。在php.ini(win下)中，寻找  error_reporting   ,设置 error_reporting  =  E_ALL &amp; ~E_NOTICE，好像默认就是这个。</li>
<li>如果还是找不到，那么在你程序的头上加上:error_reporting(2047),这样错误也都会出来。</li>
</ol>
<p>这两条是程序有硬伤的时候，直接报出来。如果逻辑上的错误，咋调呢？我的方法比较奔，但的确有效。</p>
<ol>
<li>输入echo &#8220;aaa&#8221;;break; 这样，可以判断出程序是哪里出问题而中断了。</li>
<li>print_r($var);这样去跟踪你认为出错的数据，用肉眼监视＋大脑计算，去对比程序的计算，只要涉及变量值可能改变的地方，都得去对比。</li>
</ol>
<p>这是程序差错的方法。mysql就更简单了，把你认为有错误的sql语句echo出来，放到phpmyadmin里去执行，看那个报错就行了。</p>
<p>最后一点：下载个星际译王，当然是指英文不太利索的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/08/%e7%a8%8b%e5%ba%8f%e8%b0%83%e5%bc%8fn%e5%a4%9a%e6%8b%9b.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Service来做简单认证服务器</title>
		<link>http://www.sunboyu.cn/2008/07/08/web-service%e6%9d%a5%e5%81%9a%e7%ae%80%e5%8d%95%e8%ae%a4%e8%af%81%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/08/web-service%e6%9d%a5%e5%81%9a%e7%ae%80%e5%8d%95%e8%ae%a4%e8%af%81%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml#comments</comments>
		<pubDate>Tue, 08 Jul 2008 03:21:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[APACHE]]></category>
		<category><![CDATA[技术存档]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[认证]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=183</guid>
		<description><![CDATA[Web Service简介
Web Service主要是为了使原来各孤立的站点之间的信息能够相互通信、共享而提出的一种接口。 Web Service所使用的是Internet上统一、开放的标准，如HTTP、XML、SOAP（简单对象访问协议）、WSDL等，所以Web Service可以在任何支持这些标准的环境（Windows,Linux）中使用。注：SOAP协议（Simple Object Access Protocal,简单对象访问协议）,它是一个用于分散和分布式环境下网络信息交换的基于XML的通讯协议。在此协议下，软件组件或应用程序能够通过标准的HTTP协议进行通讯。它的设计目标就是简单性和扩展性，这有助于大量异构程序和平台之间的互操作性，从而使存在的应用程序能够被广泛的用户访问。
最近写一个认证服务器，需要进行不同程序，不同数据库之间的数据交换，认证服务器提供认证功能，而客户端可能是多种语言开发的。如果实用传统的方式，比如C，或者java开发一个稳定的服务端，人力精力都是问题，只能寻求一种简单的方式进行过渡。
这里我选择了Web Service这种方式，但这种方式也存在一定问题：速度。网上普遍反映速度是问题，soap的方式本身负载是问题，实用xmlrpc，http方式，瓶颈在于webserver的负载能力。但是项目发展初期，此方式完全能满足一段时间，而这段时间我们也能平滑过渡，留出时间进行更深层次的研究。
]]></description>
			<content:encoded><![CDATA[<p>Web Service简介</p>
<div style="border:dotted 1px;padding:5px">Web Service主要是为了使原来各孤立的站点之间的信息能够相互通信、共享而提出的一种接口。 Web Service所使用的是Internet上统一、开放的标准，如HTTP、XML、SOAP（简单对象访问协议）、WSDL等，所以Web Service可以在任何支持这些标准的环境（Windows,Linux）中使用。注：SOAP协议（Simple Object Access Protocal,简单对象访问协议）,它是一个用于分散和分布式环境下网络信息交换的基于XML的通讯协议。在此协议下，软件组件或应用程序能够通过标准的HTTP协议进行通讯。它的设计目标就是简单性和扩展性，这有助于大量异构程序和平台之间的互操作性，从而使存在的应用程序能够被广泛的用户访问。</div>
<p>最近写一个认证服务器，需要进行不同程序，不同数据库之间的数据交换，认证服务器提供认证功能，而客户端可能是多种语言开发的。如果实用传统的方式，比如C，或者java开发一个稳定的服务端，人力精力都是问题，只能寻求一种简单的方式进行过渡。</p>
<p>这里我选择了Web Service这种方式，但这种方式也存在一定问题：速度。网上普遍反映速度是问题，soap的方式本身负载是问题，实用xmlrpc，http方式，瓶颈在于webserver的负载能力。但是项目发展初期，此方式完全能满足一段时间，而这段时间我们也能平滑过渡，留出时间进行更深层次的研究。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/08/web-service%e6%9d%a5%e5%81%9a%e7%ae%80%e5%8d%95%e8%ae%a4%e8%af%81%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPer市场供求关系调查</title>
		<link>http://www.sunboyu.cn/2008/07/04/phper%e5%b8%82%e5%9c%ba%e4%be%9b%e6%b1%82%e5%85%b3%e7%b3%bb%e8%b0%83%e6%9f%a5.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/04/phper%e5%b8%82%e5%9c%ba%e4%be%9b%e6%b1%82%e5%85%b3%e7%b3%bb%e8%b0%83%e6%9f%a5.shtml#comments</comments>
		<pubDate>Fri, 04 Jul 2008 14:56:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[纯属蛋疼]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[培训]]></category>
		<category><![CDATA[招聘]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=180</guid>
		<description><![CDATA[所有招聘网站均直接搜索关键词 PHP
chinahr.com     共有2111条结果   全国
zhaopin.com   共 1042 个职位   北京
51job.com    约有 4412 项符合条件的查询结果  全国
约有21,200,000项符合php 培训的查询结果      GOOGLE搜索 PHP 培训 关键词
趋势是显而易见的，PHP在WEB领域独领风骚。人才呢，您自己思考。
]]></description>
			<content:encoded><![CDATA[<p>所有招聘网站均直接搜索关键词 PHP</p>
<p>chinahr.com     共有2111条结果   全国</p>
<p>zhaopin.com   共 1042 个职位   北京</p>
<p>51job.com    约有 4412 项符合条件的查询结果  全国</p>
<p>约有21,200,000项符合php 培训的查询结果      GOOGLE搜索 PHP 培训 关键词</p>
<p>趋势是显而易见的，PHP在WEB领域独领风骚。人才呢，您自己思考。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/04/phper%e5%b8%82%e5%9c%ba%e4%be%9b%e6%b1%82%e5%85%b3%e7%b3%bb%e8%b0%83%e6%9f%a5.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>今天申请了一个google code的帐号</title>
		<link>http://www.sunboyu.cn/2008/06/28/%e4%bb%8a%e5%a4%a9%e7%94%b3%e8%af%b7%e4%ba%86%e4%b8%80%e4%b8%aagoogle-code%e7%9a%84%e5%b8%90%e5%8f%b7.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/28/%e4%bb%8a%e5%a4%a9%e7%94%b3%e8%af%b7%e4%ba%86%e4%b8%80%e4%b8%aagoogle-code%e7%9a%84%e5%b8%90%e5%8f%b7.shtml#comments</comments>
		<pubDate>Sat, 28 Jun 2008 08:30:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[技术存档]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=163</guid>
		<description><![CDATA[http://code.google.com/p/phpdeveloppackage/
免费，挺好用，管理自己的一些代码，挺好的。
以后拼命的结果就都在这里了。
]]></description>
			<content:encoded><![CDATA[<p>http://code.google.com/p/phpdeveloppackage/</p>
<p>免费，挺好用，管理自己的一些代码，挺好的。</p>
<p>以后拼命的结果就都在这里了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/28/%e4%bb%8a%e5%a4%a9%e7%94%b3%e8%af%b7%e4%ba%86%e4%b8%80%e4%b8%aagoogle-code%e7%9a%84%e5%b8%90%e5%8f%b7.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP是草根语言，在中国是一种曲解</title>
		<link>http://www.sunboyu.cn/2008/06/23/php%e6%98%af%e8%8d%89%e6%a0%b9%e8%af%ad%e8%a8%80%ef%bc%8c%e5%9c%a8%e4%b8%ad%e5%9b%bd%e6%98%af%e4%b8%80%e7%a7%8d%e6%9b%b2%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/23/php%e6%98%af%e8%8d%89%e6%a0%b9%e8%af%ad%e8%a8%80%ef%bc%8c%e5%9c%a8%e4%b8%ad%e5%9b%bd%e6%98%af%e4%b8%80%e7%a7%8d%e6%9b%b2%e8%a7%a3.shtml#comments</comments>
		<pubDate>Mon, 23 Jun 2008 12:10:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[相当拍砖]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[草根]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=139</guid>
		<description><![CDATA[突然看到一本图书的作者介绍，才发现，原来PHP在外国也是很风光的。

作者介绍：
Laura Thomson是澳大利亚墨尔本RMIT大学计算机科学信息技术学院的讲师。她也是Tangled Web Design公司的合伙人。Laura曾经在Telstra和波士顿顾问集团工作过。她获得了应用科学（计算机科学）的学士学位和工程学（计算机系统工 程）学士学位，目前她正在攻读适应性Web站点的博士学位。
]]></description>
			<content:encoded><![CDATA[<p>突然看到一本图书的作者介绍，才发现，原来PHP在外国也是很风光的。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/s1627655.jpg"><img class="aligncenter size-full wp-image-140" title="s1627655" src="http://www.sunboyu.cn/upfiles/2008/06/s1627655.jpg" alt="" width="107" height="138" /></a></p>
<p>作者介绍：</p>
<div class="indent">Laura Thomson是澳大利亚墨尔本RMIT大学计算机科学信息技术学院的讲师。她也是Tangled Web Design公司的合伙人。Laura曾经在Telstra和波士顿顾问集团工作过。她获得了应用科学（计算机科学）的学士学位和工程学（计算机系统工 程）学士学位，目前她正在攻读适应性Web站点的博士学位。</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/23/php%e6%98%af%e8%8d%89%e6%a0%b9%e8%af%ad%e8%a8%80%ef%bc%8c%e5%9c%a8%e4%b8%ad%e5%9b%bd%e6%98%af%e4%b8%80%e7%a7%8d%e6%9b%b2%e8%a7%a3.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>被困难压住了！</title>
		<link>http://www.sunboyu.cn/2008/06/18/%e8%a2%ab%e5%9b%b0%e9%9a%be%e5%8e%8b%e4%bd%8f%e4%ba%86%ef%bc%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/18/%e8%a2%ab%e5%9b%b0%e9%9a%be%e5%8e%8b%e4%bd%8f%e4%ba%86%ef%bc%81.shtml#comments</comments>
		<pubDate>Wed, 18 Jun 2008 15:45:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[原创技术]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=124</guid>
		<description><![CDATA[最近一直在研究php中CLI的应用，可最近两天晚上配置调试环境却遇到了很大的问题。
原来在写shell中 php -q参数居然不那么好用了，我用的php5.2.6，编译的时间加上了&#8211;enable-cli 参数，而查看帮助后 php -v,挨个试了相关参数，发现用 php -c 居然可以通过，而同一个命令，在php5.1.2版本下跟php5.2.6又不同。
询问了专家级人物奶瓶，解释亦不同。
怀疑是编译的时候少了什么参数，于是用yum install php进行安装，测试
]]></description>
			<content:encoded><![CDATA[<p>最近一直在研究php中CLI的应用，可最近两天晚上配置调试环境却遇到了很大的问题。<br />
原来在写shell中 php -q参数居然不那么好用了，我用的php5.2.6，编译的时间加上了&#8211;enable-cli 参数，而查看帮助后 php -v,挨个试了相关参数，发现用 php -c 居然可以通过，而同一个命令，在php5.1.2版本下跟php5.2.6又不同。<br />
询问了专家级人物奶瓶，解释亦不同。<br />
怀疑是编译的时候少了什么参数，于是用yum install php进行安装，测试</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/18/%e8%a2%ab%e5%9b%b0%e9%9a%be%e5%8e%8b%e4%bd%8f%e4%ba%86%ef%bc%81.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP中工厂方式的三层结构</title>
		<link>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e5%b7%a5%e5%8e%82%e6%96%b9%e5%bc%8f%e7%9a%84%e4%b8%89%e5%b1%82%e7%bb%93%e6%9e%84.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e5%b7%a5%e5%8e%82%e6%96%b9%e5%bc%8f%e7%9a%84%e4%b8%89%e5%b1%82%e7%bb%93%e6%9e%84.shtml#comments</comments>
		<pubDate>Sat, 14 Jun 2008 14:38:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[工厂模式]]></category>
		<category><![CDATA[设计模式]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=114</guid>
		<description><![CDATA[项目即将收尾，但有些代码乱七八糟，不少东西是为了赶时间而写成了流水程序。功能出来了，但代码可读性和可维护性却相当差。当然拿出少量时间给代码排个版是很有必要的，这里我一直主张工厂模式三层结构的方法。

网站基本是传统的机构，数据库，web，在这里，我们只讨论web中程序的结构。

三层，主要是指子类，抽象工厂方法，业务逻辑处理。
子类：子类是所有跟程序之外对象进行交互的类，包括跟数据库，磁盘存储，xml等的处理。子类有个特征，就是可以迁移到任意的项目中进行复用，也就是整个项目中最底层的一些操作。
工厂方法：工厂方法就是使用子类提供的功能进行整合，构造出能够满足一些业务具体功能的方法。
业务处理：业务处理主要是UI部分，根据用户的请求来选择合适的工厂方法，把工厂方法的返回产品数据输出给用户。
]]></description>
			<content:encoded><![CDATA[<p>项目即将收尾，但有些代码乱七八糟，不少东西是为了赶时间而写成了流水程序。功能出来了，但代码可读性和可维护性却相当差。当然拿出少量时间给代码排个版是很有必要的，这里我一直主张工厂模式三层结构的方法。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/e69caae591bde5908d-1.jpg"><img class="alignnone size-full wp-image-115" title="e69caae591bde5908d-1" src="http://www.sunboyu.cn/upfiles/2008/06/e69caae591bde5908d-1.jpg" alt="" width="500" height="167" /></a></p>
<p>网站基本是传统的机构，数据库，web，在这里，我们只讨论web中程序的结构。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/phpe7a88be5ba8fe8aebee8aea1e7bb93e69e84e59bbe.jpg"><img class="alignnone size-full wp-image-116" title="phpe7a88be5ba8fe8aebee8aea1e7bb93e69e84e59bbe" src="http://www.sunboyu.cn/upfiles/2008/06/phpe7a88be5ba8fe8aebee8aea1e7bb93e69e84e59bbe.jpg" alt="" width="500" height="167" /></a></p>
<h2><span style="color: #000080;"><strong>三层，主要是指子类，抽象工厂方法，业务逻辑处理。</strong></span></h2>
<p><span style="text-decoration: underline;"><strong>子类：</strong></span>子类是所有跟程序之外对象进行交互的类，包括跟数据库，磁盘存储，xml等的处理。子类有个特征，就是可以迁移到任意的项目中进行复用，也就是整个项目中最底层的一些操作。</p>
<p><strong><span style="text-decoration: underline;">工厂方法：</span></strong>工厂方法就是使用子类提供的功能进行整合，构造出能够满足一些业务具体功能的方法。</p>
<p><strong><span style="text-decoration: underline;">业务处理：</span></strong>业务处理主要是UI部分，根据用户的请求来选择合适的工厂方法，把工厂方法的返回产品数据输出给用户。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e5%b7%a5%e5%8e%82%e6%96%b9%e5%bc%8f%e7%9a%84%e4%b8%89%e5%b1%82%e7%bb%93%e6%9e%84.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP中数据有效性验证</title>
		<link>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%9c%89%e6%95%88%e6%80%a7%e9%aa%8c%e8%af%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%9c%89%e6%95%88%e6%80%a7%e9%aa%8c%e8%af%81.shtml#comments</comments>
		<pubDate>Sat, 14 Jun 2008 12:54:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[变量]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=113</guid>
		<description><![CDATA[在php的开发过程中，我们的error_reporting()开到最严格，2047，因此，好多php本身可避免的报错也都会出来，就跟C一样让在在强类型状态下工作。
为了尽量使程序兼容，我们对每个变量的有效性进行严格判断。
我一般使用 isset($a) ? $a : &#8221;;这种方式对变量进行判断，如果变量不存在的话初始化变量。
当然在其他的地方也可以使用该方法检验变量有效性。
底下是大部分进行验证的函数。
检测变量状态： isset()   empty()
检测变量类型 is_array() is_double() is_float() is_real()  is_long() is_int() is_integer() is_string() is_object()
具体使用可以查下手册
PHP并不比C或者其他语言差，关键在于你编程的态度.
]]></description>
			<content:encoded><![CDATA[<p>在php的开发过程中，我们的error_reporting()开到最严格，2047，因此，好多php本身可避免的报错也都会出来，就跟C一样让在在强类型状态下工作。</p>
<p>为了尽量使程序兼容，我们对每个变量的有效性进行严格判断。</p>
<p>我一般使用 isset($a) ? $a : &#8221;;这种方式对变量进行判断，如果变量不存在的话初始化变量。</p>
<p>当然在其他的地方也可以使用该方法检验变量有效性。</p>
<p>底下是大部分进行验证的函数。</p>
<p>检测变量状态： isset()   empty()</p>
<p>检测变量类型 is_array() is_double() is_float() is_real()  is_long() is_int() is_integer() is_string() is_object()</p>
<p>具体使用可以查下手册</p>
<p>PHP并不比C或者其他语言差，关键在于你编程的态度.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%9c%89%e6%95%88%e6%80%a7%e9%aa%8c%e8%af%81.shtml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>centos5安装指南（简单篇）</title>
		<link>http://www.sunboyu.cn/2008/06/13/centos5%e5%ae%89%e8%a3%85%e6%8c%87%e5%8d%97%ef%bc%88%e7%ae%80%e5%8d%95%e7%af%87%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/13/centos5%e5%ae%89%e8%a3%85%e6%8c%87%e5%8d%97%ef%bc%88%e7%ae%80%e5%8d%95%e7%af%87%ef%bc%89.shtml#comments</comments>
		<pubDate>Fri, 13 Jun 2008 13:50:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[图形]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=87</guid>
		<description><![CDATA[
进入默认页面，直接回车即可

测试光盘文件的完整性，我一般都跳过


直接下一步

我一般都选择英文，因为命令行里好像不很支持中文

格盘，yes即可。注意：这里是在虚拟机或者一个空机器上进行安装，如果你在其他操作系统上安装双系统，此操作危险！

NEXT，使用默认的即可

YES,继续

分配IP地址，或者使用dhcp，此知识点不懂的话，不归本文管。

设置系统时区，一般用UTC，虽然有时候会用东八区。

设置root帐号的密码

选择定制安装或者是定制安装，当然我们要定制安装。

选择Development中的Development Libraries,Development Tools

选择Base System中的Base和Legacy Software Support
选择这四个，其他的就都不要选了，需要的话再慢慢装。

NEXT开始安装

装完，重启

root登录

这样安装AMP(APACHE MYSQL PHP)即可
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/06/1.jpg"><img class="alignnone size-medium wp-image-91" title="1" src="http://www.sunboyu.cn/upfiles/2008/06/1-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>进入默认页面，直接回车即可</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/2.jpg"><img class="alignnone size-medium wp-image-92" title="2" src="http://www.sunboyu.cn/upfiles/2008/06/2-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>测试光盘文件的完整性，我一般都跳过</p>
<p><span id="more-87"></span></p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/3.jpg"><img class="alignnone size-medium wp-image-93" title="3" src="http://www.sunboyu.cn/upfiles/2008/06/3-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>直接下一步</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/4.jpg"><img class="alignnone size-medium wp-image-94" title="4" src="http://www.sunboyu.cn/upfiles/2008/06/4-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>我一般都选择英文，因为命令行里好像不很支持中文</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/6.jpg"><img class="alignnone size-medium wp-image-96" title="6" src="http://www.sunboyu.cn/upfiles/2008/06/6-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>格盘，yes即可。注意：这里是在虚拟机或者一个空机器上进行安装，如果你在其他操作系统上安装双系统，此操作危险！</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/7.jpg"><img class="alignnone size-medium wp-image-97" title="7" src="http://www.sunboyu.cn/upfiles/2008/06/7-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>NEXT，使用默认的即可</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/8.jpg"><img class="alignnone size-medium wp-image-98" title="8" src="http://www.sunboyu.cn/upfiles/2008/06/8-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>YES,继续</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/9.jpg"><img class="alignnone size-medium wp-image-99" title="9" src="http://www.sunboyu.cn/upfiles/2008/06/9-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>分配IP地址，或者使用dhcp，此知识点不懂的话，不归本文管。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/10.jpg"><img class="alignnone size-medium wp-image-100" title="10" src="http://www.sunboyu.cn/upfiles/2008/06/10-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>设置系统时区，一般用UTC，虽然有时候会用东八区。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/11.jpg"><img class="alignnone size-medium wp-image-101" title="11" src="http://www.sunboyu.cn/upfiles/2008/06/11-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>设置root帐号的密码</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/12.jpg"><img class="alignnone size-medium wp-image-102" title="12" src="http://www.sunboyu.cn/upfiles/2008/06/12-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>选择定制安装或者是定制安装，当然我们要定制安装。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/13.jpg"><img class="alignnone size-medium wp-image-103" title="13" src="http://www.sunboyu.cn/upfiles/2008/06/13-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>选择Development中的Development Libraries,Development Tools</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/14.jpg"><img class="alignnone size-medium wp-image-104" title="14" src="http://www.sunboyu.cn/upfiles/2008/06/14-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>选择Base System中的Base和Legacy Software Support</p>
<p>选择这四个，其他的就都不要选了，需要的话再慢慢装。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/15.jpg"><img class="alignnone size-medium wp-image-105" title="15" src="http://www.sunboyu.cn/upfiles/2008/06/15-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>NEXT开始安装</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/17.jpg"><img class="alignnone size-medium wp-image-107" title="17" src="http://www.sunboyu.cn/upfiles/2008/06/17-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>装完，重启</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/18.jpg"><img class="alignnone size-medium wp-image-108" title="18" src="http://www.sunboyu.cn/upfiles/2008/06/18-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>root登录</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/19.jpg"><img class="alignnone size-medium wp-image-109" title="19" src="http://www.sunboyu.cn/upfiles/2008/06/19-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>这样安装AMP(APACHE MYSQL PHP)即可</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/13/centos5%e5%ae%89%e8%a3%85%e6%8c%87%e5%8d%97%ef%bc%88%e7%ae%80%e5%8d%95%e7%af%87%ef%bc%89.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>混过一天是一天</title>
		<link>http://www.sunboyu.cn/2008/06/05/%e6%b7%b7%e8%bf%87%e4%b8%80%e5%a4%a9%e6%98%af%e4%b8%80%e5%a4%a9.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/05/%e6%b7%b7%e8%bf%87%e4%b8%80%e5%a4%a9%e6%98%af%e4%b8%80%e5%a4%a9.shtml#comments</comments>
		<pubDate>Thu, 05 Jun 2008 00:55:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[相当拍砖]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[清河]]></category>
		<category><![CDATA[网通]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=66</guid>
		<description><![CDATA[又一天了，烦恼的上班下班，自行车冲锋！总是想起一个电影名字《冲出亚马逊》，而我每天是冲出清河镇。
家里不能上网，好久没学习，昨天看了看分词，除了二分法和词库分词法，也没看出点什么。
收了两个徒弟，教他们PHP，一直也没时间。
网通办事效率有点太低了，BS我们大班长！
上网后拼命学习！
]]></description>
			<content:encoded><![CDATA[<p>又一天了，烦恼的上班下班，自行车冲锋！总是想起一个电影名字《冲出亚马逊》，而我每天是冲出清河镇。</p>
<p>家里不能上网，好久没学习，昨天看了看分词，除了二分法和词库分词法，也没看出点什么。</p>
<p>收了两个徒弟，教他们PHP，一直也没时间。</p>
<p>网通办事效率有点太低了，BS我们大班长！</p>
<p>上网后拼命学习！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/05/%e6%b7%b7%e8%bf%87%e4%b8%80%e5%a4%a9%e6%98%af%e4%b8%80%e5%a4%a9.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Shell初体验</title>
		<link>http://www.sunboyu.cn/2008/05/25/php-shell%e5%88%9d%e4%bd%93%e9%aa%8c.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/25/php-shell%e5%88%9d%e4%bd%93%e9%aa%8c.shtml#comments</comments>
		<pubDate>Sun, 25 May 2008 08:59:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[原创技术]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=53</guid>
		<description><![CDATA[在linux（centos5）上编译安装 php-5.2.6.tar.gz ,configure参数一定要带上 &#8211;enable-cli
完成后，php所在目录 /usr/local/bin/php
运营  ./php -v  显示php版本信息，证明安装成功
编写我的第一个php shell脚本
#!/usr/local/bin/php -q
echo &#8220;Hello World!&#8221;;
?&#62;
保存为 test.sh
运行，屏幕会 回显 Hello World!
在命令行下，不会存在get post之类的动作，除非参数写到页面内，而php恰巧提供了这样的命令行参数接口，$argv
修改test.sh
#!/usr/local/bin/php -q
print_r($argv);
?&#62;
加参数运行  ./test.sh  t1 t2   ，回显为
Array
(
[0] =&#62; ./test.sh
[1] =&#62; t1
[2] =&#62; t2
)
]]></description>
			<content:encoded><![CDATA[<p>在linux（centos5）上编译安装 php-5.2.6.tar.gz ,configure参数一定要带上 &#8211;enable-cli</p>
<p>完成后，php所在目录 /usr/local/bin/php</p>
<p>运营  ./php -v  显示php版本信息，证明安装成功</p>
<p>编写我的第一个php shell脚本<br />
#!/usr/local/bin/php -q<br />
echo &#8220;Hello World!&#8221;;<br />
?&gt;</p>
<p>保存为 test.sh<br />
运行，屏幕会 回显 Hello World!</p>
<p>在命令行下，不会存在get post之类的动作，除非参数写到页面内，而php恰巧提供了这样的命令行参数接口，$argv<br />
修改test.sh<br />
#!/usr/local/bin/php -q<br />
print_r($argv);<br />
?&gt;</p>
<p>加参数运行  ./test.sh  t1 t2   ，回显为</p>
<p>Array<br />
(<br />
[0] =&gt; ./test.sh<br />
[1] =&gt; t1<br />
[2] =&gt; t2<br />
)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/25/php-shell%e5%88%9d%e4%bd%93%e9%aa%8c.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP SHELL，用php来代替bash</title>
		<link>http://www.sunboyu.cn/2008/05/24/php-shell%ef%bc%8c%e7%94%a8php%e6%9d%a5%e4%bb%a3%e6%9b%bfbash.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/24/php-shell%ef%bc%8c%e7%94%a8php%e6%9d%a5%e4%bb%a3%e6%9b%bfbash.shtml#comments</comments>
		<pubDate>Sat, 24 May 2008 15:50:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[原创技术]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[eefocus]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=52</guid>
		<description><![CDATA[总看到招聘php程序员的帖子说要求php程序员熟练运用linux,shell,我估计熟悉LAMP配置，在这个架构下开发php的人不在少数，但说到SHELL，估计有一批人一冒一身的冷汗。
c shell，bash shell的确用的少，但php shell你说不懂，就该左右开弓一百八十个大嘴巴。
php本身就是一种shell，在php4之后，php编译有个 &#8211;enable-cli 参数，php5之后这个参数几乎成了标配参数。php一样可以作为shell脚本运行在装有php环境的服务器上。
而在phpchina.com phpx.com总多bbs的招聘上，居然没有哪个php程序员拿出php shell这个技能去跟他们交涉。而实际上，phpshell的功能根本不比bash弱，而且在LAMP环境中，php shell比bashshell有诸多的优点。
下边是我在与非门科技工作时候的几个php shell应用，抛砖引玉，希望大家能学会这些简单但又适用的技能。
$root = &#8220;/var/www/&#8221;;
$bakdir = &#8220;/var/wwwbak/&#8221;.date(&#8221;Y-m-d&#8221;);
$dir = array(&#8221;***.eefocus.com&#8221;,&#8221;***.eefocus.com&#8221;);
if(!is_dir($bakdir)){
mkdir($bakdir);
}
foreach($dir as $key=&#62;$value)
{
exec(&#8221;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value);
#echo &#8220;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value.&#8221;
&#8220;;
}
?&#62;
这是一个简单的网站目录备份程序，使用cron每天执行，自动tar压包备份网站。虽然很笨的方法，但网站安全系数提高了，这个过程也不用写啥bash去解决。
其实在php执行shell的时候，已经支持命令行参数了，这些应用下次分解。
参考网站：
http://www.phpbuilder.com/columns/darrell20000319.php3
http://www.php-cli.com/
]]></description>
			<content:encoded><![CDATA[<p>总看到招聘php程序员的帖子说要求php程序员熟练运用linux,shell,我估计熟悉LAMP配置，在这个架构下开发php的人不在少数，但说到SHELL，估计有一批人一冒一身的冷汗。<br />
c shell，bash shell的确用的少，但php shell你说不懂，就该左右开弓一百八十个大嘴巴。<br />
php本身就是一种shell，在php4之后，php编译有个 &#8211;enable-cli 参数，php5之后这个参数几乎成了标配参数。php一样可以作为shell脚本运行在装有php环境的服务器上。<br />
而在phpchina.com phpx.com总多bbs的招聘上，居然没有哪个php程序员拿出php shell这个技能去跟他们交涉。而实际上，phpshell的功能根本不比bash弱，而且在LAMP环境中，php shell比bashshell有诸多的优点。</p>
<p>下边是我在<a href="http://www.eefocus.com" target="_blank">与非门科技</a><img src="http://www.eefocus.com/images/logo.gif" alt="" width="73" height="21" />工作时候的几个php shell应用，抛砖引玉，希望大家能学会这些简单但又适用的技能。</p>
<p>$root = &#8220;/var/www/&#8221;;<br />
$bakdir = &#8220;/var/wwwbak/&#8221;.date(&#8221;Y-m-d&#8221;);<br />
$dir = array(&#8221;***.eefocus.com&#8221;,&#8221;***.eefocus.com&#8221;);<br />
if(!is_dir($bakdir)){<br />
mkdir($bakdir);<br />
}<br />
foreach($dir as $key=&gt;$value)<br />
{<br />
exec(&#8221;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value);<br />
#echo &#8220;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value.&#8221;<br />
&#8220;;<br />
}<br />
?&gt;</p>
<p>这是一个简单的网站目录备份程序，使用cron每天执行，自动tar压包备份网站。虽然很笨的方法，但网站安全系数提高了，这个过程也不用写啥bash去解决。</p>
<p>其实在php执行shell的时候，已经支持命令行参数了，这些应用下次分解。</p>
<p>参考网站：</p>
<p>http://www.phpbuilder.com/columns/darrell20000319.php3</p>
<p>http://www.php-cli.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/24/php-shell%ef%bc%8c%e7%94%a8php%e6%9d%a5%e4%bb%a3%e6%9b%bfbash.shtml/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>centos5安装nginx＋mysql＋php fastcgi模式</title>
		<link>http://www.sunboyu.cn/2008/05/18/centos5%e5%ae%89%e8%a3%85nginx%ef%bc%8bmysql%ef%bc%8bphp-fastcgi%e6%a8%a1%e5%bc%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/18/centos5%e5%ae%89%e8%a3%85nginx%ef%bc%8bmysql%ef%bc%8bphp-fastcgi%e6%a8%a1%e5%bc%8f.shtml#comments</comments>
		<pubDate>Sun, 18 May 2008 04:20:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[原创技术]]></category>
		<category><![CDATA[centos5]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=9</guid>
		<description><![CDATA[原教程 http://blog.s135.com/read.php/314.htm
安装环境：centos5.0 基本系统＋开发工具
安装xml组件
yum install libxml2  libxml2-devel
编译安装 php
./configure  &#8211;enable-fastcgi  &#8211;enable-force-cgi-redirect
make &#38;&#38; make install
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
[root@localhost php-5.2.5]# make install
Installing PHP SAPI  module:       cgi
Installing PHP CGI binary:        /usr/local/bin/
Installing PHP CLI binary:        /usr/local/bin/
Installing PHP CLI man  [...]]]></description>
			<content:encoded><![CDATA[<div id="blogContainer">原教程 <a onclick="showLinkBubble(this);return false" href="http://blog.s135.com/read.php/314.htm" target="_blank">http://blog.s135.com/read.php/314.htm</a></p>
<p>安装环境：centos5.0 基本系统＋开发工具</p>
<p>安装xml组件<br />
yum install libxml2  libxml2-devel</p>
<p>编译安装 php<br />
./configure  &#8211;enable-fastcgi  &#8211;enable-force-cgi-redirect<br />
make &amp;&amp; make install<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[root@localhost php-5.2.5]# make install<br />
Installing PHP SAPI  module:       cgi<br />
Installing PHP CGI binary:        /usr/local/bin/<br />
Installing PHP CLI binary:        /usr/local/bin/<br />
Installing PHP CLI man  page:      /usr/local/man/man1/<br />
Installing build environment:      /usr/local/lib/php/build/<br />
Installing header  files:          /usr/local/include/php/<br />
Installing helper programs:        /usr/local/bin/<br />
program: phpize<br />
program: php-config<br />
Installing  man pages:             /usr/local/man/man1/<br />
page: phpize.1<br />
page:  php-config.1<br />
Installing PEAR environment:      /usr/local/lib/php/<br />
[PEAR] Console_Getopt &#8211; installed: 1.2.3<br />
[PEAR] Archive_Tar    &#8211;  installed: 1.3.2<br />
[PEAR] Structures_Graph- installed: 1.0.2<br />
pear/PEAR can  optionally use package &#8220;pear/XML_RPC&#8221; (version &gt;= 1.4.0)<br />
[PEAR]  PEAR           &#8211; installed: 1.6.1<br />
Wrote PEAR system config file at:  /usr/local/etc/pear.conf<br />
You may want to add: /usr/local/lib/php to your  php.ini include_path<br />
Installing PDO  headers:          /usr/local/include/php/ext/pdo/<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
make test</p>
<p>yum安装mysql<br />
yum install mysql mysql-devel mysql-server</p>
<p>复制spawn-fcgi 至 /usr/local/bin/<br />
chmod +x spawn-fcgi</p>
<p>/usr/sbin/groupadd www -g 48<br />
/usr/sbin/useradd -u 48 -g www www<br />
使用spawn-fcgi监听127.0.0.1的10080端口 进程10 用户www<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[root@localhost bin]# spawn-fcgi -a 127.0.0.1 -p 10080 -C 10 -u www -f  php-cgi<br />
X-Powered-By: PHP/5.2.5<br />
Content-type: text/html<br />
spawn-fcgi.c.211: child exited with: 0, Success<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[root@localhost bin]# spawn-fcgi -a 127.0.0.1 -p 10080 -C 10 -u www -f  php-cgi<br />
spawn-fcgi.c.190: child spawned successfully: PID: 27936<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
安装pcre<br />
yum install pcre pcre-devel<br />
编译安装 nginx<br />
./configure  &#8211;user=www &#8211;group=www<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Configuration summary<br />
+ threads are not used<br />
+ using system PCRE  library<br />
+ OpenSSL library is not used<br />
+ md5 library is not used<br />
+ sha1 library is not used<br />
+ using system zlib library<br />
nginx  path prefix: &#8220;/usr/local/nginx&#8221;<br />
nginx binary file:  &#8220;/usr/local/nginx/sbin/nginx&#8221;<br />
nginx configuration file:  &#8220;/usr/local/nginx/conf/nginx.conf&#8221;<br />
nginx pid file:  &#8220;/usr/local/nginx/logs/nginx.pid&#8221;<br />
nginx error log file:  &#8220;/usr/local/nginx/logs/error.log&#8221;<br />
nginx http access log file:  &#8220;/usr/local/nginx/logs/access.log&#8221;<br />
nginx http client request body  temporary files: &#8220;/usr/local/nginx/client_body_temp&#8221;<br />
nginx http proxy  temporary files: &#8220;/usr/local/nginx/proxy_temp&#8221;<br />
nginx http fastcgi  temporary files: &#8220;/usr/local/nginx/fastcgi_temp&#8221;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
make &amp;&amp; make install</p>
<p>touche /usr/local/nginx/conf/fcgi.conf<br />
内容为<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;<br />
fastcgi_param  SERVER_SOFTWARE    nginx;<br />
fastcgi_param  QUERY_STRING       $query_string;<br />
fastcgi_param  REQUEST_METHOD     $request_method;<br />
fastcgi_param  CONTENT_TYPE       $content_type;<br />
fastcgi_param  CONTENT_LENGTH     $content_length;<br />
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;<br />
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;<br />
fastcgi_param  REQUEST_URI        $request_uri;<br />
fastcgi_param  DOCUMENT_URI       $document_uri;<br />
fastcgi_param  DOCUMENT_ROOT      $document_root;<br />
fastcgi_param  SERVER_PROTOCOL    $server_protocol;<br />
fastcgi_param  REMOTE_ADDR        $remote_addr;<br />
fastcgi_param  REMOTE_PORT        $remote_port;<br />
fastcgi_param  SERVER_ADDR        $server_addr;<br />
fastcgi_param  SERVER_PORT        $server_port;<br />
fastcgi_param  SERVER_NAME        $server_name;<br />
# PHP only, required if  PHP was built with &#8211;enable-force-cgi-redirect<br />
#fastcgi_param  REDIRECT_STATUS    200;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
启动 nginx<br />
ulimit -SHn 51200<br />
/usr/local/nginx/sbin/nginx -c  /usr/local/nginx/conf/nginx.conf</p>
<p>配置开机自动启动Nginx + PHP<br />
vi  /etc/rc.local<br />
在末尾增加以下内容：<br />
ulimit -SHn 51200<br />
/usr/local/bin/spawn-fcgi  -a 127.0.0.1 -p 10080 -C 64 -u www -f /usr/local/bin/php-cgi<br />
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf</p>
<p>优化Linux内核参数<br />
vi /etc/sysctl.conf<br />
在末尾增加以下内容：<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000    65000</p>
<p>使配置立即生效：<br />
/sbin/sysctl -p<br />
在不停止Nginx服务的情况下平滑变更Nginx配置<br />
修改/usr/local/nginx/conf/nginx.conf配置文件后，请执行以下命令检查配置文件是否正确：<br />
/usr/local/webserver/nginx/sbin/nginx -t</p>
<p>这时，输入以下命令查看Nginx主进程号：<br />
ps -ef | grep &#8220;nginx: master process&#8221; | grep -v &#8220;grep&#8221; | awk -F &#8216; &#8216; &#8216;{print  $2}&#8217;</p>
<p>至于日常维护，还不太清楚，咱们下次分解</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Nginx的编译参数如下：<br />
[root@localhost]#./configure &#8211;prefix=/usr/local/server/nginx  &#8211;with-openssl=/usr/include \<br />
&#8211;with-pcre=/usr/include/pcre/  &#8211;with-http_stub_status_module &#8211;without-http_memcached_module \<br />
&#8211;without-http_fastcgi_module &#8211;without-http_rewrite_module  &#8211;without-http_map_module \<br />
&#8211;without-http_geo_module  &#8211;without-http_autoindex_module</p>
</div>
<p><img id="paperPicArea1" style="display: none; position: relative;" src="http://imgcache.qq.com/ac/qzone_v4/b.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/18/centos5%e5%ae%89%e8%a3%85nginx%ef%bc%8bmysql%ef%bc%8bphp-fastcgi%e6%a8%a1%e5%bc%8f.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.068 seconds -->
