<?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>Hello, SA &#187; php</title>
	<atom:link href="http://blog.helosa.org/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.helosa.org</link>
	<description>Linux System Administrator</description>
	<lastBuildDate>Tue, 31 Jan 2012 08:28:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>cacti 又不能采集流量了</title>
		<link>http://blog.helosa.org/2010/12/15/cacti-stop-work.html</link>
		<comments>http://blog.helosa.org/2010/12/15/cacti-stop-work.html#comments</comments>
		<pubDate>Wed, 15 Dec 2010 09:25:27 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=356</guid>
		<description><![CDATA[最近总遇到一些莫名其妙的问题，总要troubleshooting 。 先前cacti 出现过，到了一定流量时，就采集不到了。。。这个实在诡异，即使按照 joecen 说的，把output type id 改为64bit 都无济于事。。。 今天竟然发现cacti 完全不采集了！！在google 大神的帮助下，成功不明所以然地解决了，也记录一下吧。 直接原因是，采集的脚本出错： 执行，/usr/bin/php5-cgi /data/cacti/poller.php Content-type: text/html X-Powered-By: PHP/5.3.3 &#60;br&#62;&#60;strong&#62;This script is only meant to run at the command line.&#60;/strong&#62; 看来与cacti 本身没有关系，是php 执行错误。 祭出google 大神，修改 php.ini 的 register_argc_argv 为 on 。问题解决。 php 文档说，register_argc_argv 这个参数是 Tells PHP whether to declare the argv &#38; argc variables [...]]]></description>
			<content:encoded><![CDATA[<p>最近总遇到一些莫名其妙的问题，总要troubleshooting 。</p>
<p>先前cacti 出现过，到了一定流量时，就采集不到了。。。这个实在诡异，即使按照 joecen 说的，把output type id 改为64bit 都无济于事。。。</p>
<p>今天竟然发现cacti 完全不采集了！！在google 大神的帮助下，成功不明所以然地解决了，也记录一下吧。</p>
<p>直接原因是，采集的脚本出错：</p>
<p>执行，/usr/bin/php5-cgi /data/cacti/poller.php</p>
<p>Content-type: text/html<br />
X-Powered-By: PHP/5.3.3</p>
<p>&lt;br&gt;&lt;strong&gt;This script is only meant to run at the command line.&lt;/strong&gt;</p>
<p>看来与cacti 本身没有关系，是php 执行错误。</p>
<p>祭出google 大神，修改 php.ini 的 register_argc_argv 为 on 。问题解决。</p>
<p>php 文档说，<em><tt>register_argc_argv </tt></em>这个参数是</p>
<p>Tells PHP whether to declare the argv &amp; argc variables           (that would contain the GET information).</p>
<p>呃。。。我不懂 php ，我完全不知情！！^_^</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/12/15/cacti-stop-work.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php 设置response header 时的小问题</title>
		<link>http://blog.helosa.org/2010/09/27/php-response-header.html</link>
		<comments>http://blog.helosa.org/2010/09/27/php-response-header.html#comments</comments>
		<pubDate>Mon, 27 Sep 2010 14:17:53 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=335</guid>
		<description><![CDATA[今天遇到一个感觉很诡异的问题，就是 php 设置header 总是不成功，设置为返回xml ，但总是返回html 。源码大概如下： &#60;?php echo &#8220;&#60;?xml version=\&#8221;1.0\&#8221; encoding=\&#8221;UTF-8\&#8221;?&#62;\n&#8221;; header(&#8220;Content-Type: text/xml; charset=UTF-8&#8243;); echo &#8220;&#60;result&#62;\n&#8221;; echo &#8220;&#60;success&#62;false&#60;/success&#62;\n&#8221;; echo &#8220;&#60;/result&#62;&#8221;; ?&#62; 只要把header 一行移到第一个echo 的前面就行了 &#60;?php header(&#8220;Content-Type: text/xml; charset=UTF-8&#8243;); echo &#8220;&#60;?xml version=\&#8221;1.0\&#8221; encoding=\&#8221;UTF-8\&#8221;?&#62;\n&#8221;; echo &#8220;&#60;result&#62;\n&#8221;; echo &#8220;&#60;success&#62;false&#60;/success&#62;\n&#8221;; echo &#8220;&#60;/result&#62;&#8221;; ?&#62; 对php 理解和实践都不深，猜测下，只要有了 echo 的话，php 就自动将返回头设定了，无论后面是否使用header() 函数，也无法改变它的 content-type 了。不知道php5.3 是否有改变，不知道是否还有更方便的方法设置 content-type ，不管了，我只是临时去解决了个小问题。 没文化真可怕阿，我的半桶水php 水平，差点就搞不掂今天的问题了。]]></description>
			<content:encoded><![CDATA[<p>今天遇到一个感觉很诡异的问题，就是 php 设置header 总是不成功，设置为返回xml ，但总是返回html 。源码大概如下：</p>
<div id="_mcePaste">&lt;?php</div>
<div>echo &#8220;&lt;?xml version=\&#8221;1.0\&#8221; encoding=\&#8221;UTF-8\&#8221;?&gt;\n&#8221;;</div>
<div></div>
<div id="_mcePaste">header(&#8220;Content-Type: text/xml; charset=UTF-8&#8243;);</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">echo &#8220;&lt;result&gt;\n&#8221;;</div>
<div id="_mcePaste">echo &#8220;&lt;success&gt;false&lt;/success&gt;\n&#8221;;</div>
<div id="_mcePaste">echo &#8220;&lt;/result&gt;&#8221;;</div>
<p>?&gt;</p>
<p>只要把header 一行移到第一个echo 的前面就行了</p>
<div id="_mcePaste">&lt;?php</div>
<div>header(&#8220;Content-Type: text/xml; charset=UTF-8&#8243;);</div>
<div></div>
<div>echo &#8220;&lt;?xml version=\&#8221;1.0\&#8221; encoding=\&#8221;UTF-8\&#8221;?&gt;\n&#8221;;</div>
<div id="_mcePaste">echo &#8220;&lt;result&gt;\n&#8221;;</div>
<div id="_mcePaste">echo &#8220;&lt;success&gt;false&lt;/success&gt;\n&#8221;;</div>
<div id="_mcePaste">echo &#8220;&lt;/result&gt;&#8221;;</div>
<p>?&gt;</p>
<p>对php 理解和实践都不深，猜测下，只要有了 echo 的话，php 就自动将返回头设定了，无论后面是否使用header() 函数，也无法改变它的 content-type 了。不知道php5.3 是否有改变，不知道是否还有更方便的方法设置 content-type ，不管了，我只是临时去解决了个小问题。</p>
<p>没文化真可怕阿，我的半桶水php 水平，差点就搞不掂今天的问题了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/09/27/php-response-header.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>debian 下nginx 快速搭建FCGI环境</title>
		<link>http://blog.helosa.org/2010/05/14/nginx-fcgi.html</link>
		<comments>http://blog.helosa.org/2010/05/14/nginx-fcgi.html#comments</comments>
		<pubDate>Fri, 14 May 2010 06:41:51 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=256</guid>
		<description><![CDATA[我的想法是。。。快点，快点，再快点！！ apt-get install spawn-fcgi php5-cgi 用 spawn-fcgi 启动 fcgi ， spawn-fcgi -a 127.0.0.1 -p 8000 -u nobody -f /usr/bin/php-cgi -C 5 ; 在 nginx 里配置加一句： location ~ \.php$ { fastcgi_pass 127.0.0.1:8000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/nginx/html$fastcgi_script_name; include fastcgi_params; } 然后把一个 php 放在 /home/nginx/html 里，就可以使用了。]]></description>
			<content:encoded><![CDATA[<p>我的想法是。。。快点，快点，再快点！！</p>
<p>apt-get install spawn-fcgi php5-cgi</p>
<p>用 spawn-fcgi 启动 fcgi ，</p>
<p>spawn-fcgi -a 127.0.0.1 -p 8000 -u nobody -f /usr/bin/php-cgi -C 5 ;</p>
<p>在 nginx 里配置加一句：<br />
location ~ \.php$ {<br />
fastcgi_pass   127.0.0.1:8000;<br />
fastcgi_index  index.php;<br />
fastcgi_param  SCRIPT_FILENAME  /home/nginx/html$fastcgi_script_name;<br />
include        fastcgi_params;<br />
}</p>
<p>然后把一个 php 放在 /home/nginx/html 里，就可以使用了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/05/14/nginx-fcgi.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>新搭建的nagios+pnp爆的一个错误</title>
		<link>http://blog.helosa.org/2010/01/19/nagios-pnp-php.html</link>
		<comments>http://blog.helosa.org/2010/01/19/nagios-pnp-php.html#comments</comments>
		<pubDate>Tue, 19 Jan 2010 11:33:10 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://lazybug.me/?p=31</guid>
		<description><![CDATA[部门明天要上一个大项目啊，我今天赶紧搭监控。 原谅我这个古董，21 世纪了，还在搭nagios。。。web 环境，我也还是很古董地选用apache + php_module 的方式。。。其实监控系统来说，没什么性能要求，apache和nagios 也符合我的需求了，好，开始！！ 首先爆了一堆这样的错： Deprecated: Assigning the return value of new by reference is deprecated in /data/nagios/share/pnp/include/function.inc.php on line 1029 Warning: date() [function.date]: It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used [...]]]></description>
			<content:encoded><![CDATA[<p>部门明天要上一个大项目啊，我今天赶紧搭监控。</p>
<p>原谅我这个古董，21 世纪了，还在搭nagios。。。web 环境，我也还是很古董地选用apache + php_module 的方式。。。其实监控系统来说，没什么性能要求，apache和nagios 也符合我的需求了，好，开始！！</p>
<p>首先爆了一堆这样的错：</p>
<p><strong>Deprecated</strong>:  Assigning the return value of new by reference is deprecated in <strong>/data/nagios/share/pnp/include/function.inc.php</strong> on line <strong>1029</strong></p>
<p><strong>Warning</strong>:  date() [<a href="http://60.191.80.115:8163/nagios/pnp/function.date">function.date</a>]: It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &#8216;Asia/Chongqing&#8217; for &#8216;CST/8.0/no DST&#8217; instead in <strong>/data/nagios/share/pnp/include/function.inc.php</strong> on line <strong>560</strong></p>
<p>貌似 5.3.0 才报这样的错，5.2.9 也没有爆啊。。。没错，我是很懒，但一般我都会追求真相的。但是，项目明天就要上线了啊，时间不允许我这样玩了，我还是懒一点吧。。。以解决问题为最终目标！！</p>
<p>让我设timezone。。。不太会php啊。。。也没研究过nagios的架构。。。直接一点吧，见到什么改什么！！</p>
<p>function.inc.php 貌似是一个基础函数，每个函数都会include它的，我在里面显式地指定timezone总可以吧，于是在function.inc.php 里加一句</p>
<p>date_default_timezone_set(&#8216;Asia/Chongqing&#8217;);</p>
<p>哈哈，timezone 的 warning 解决了！但问题随之又来了。。。又报错。。。</p>
<p><strong>Deprecated</strong>:  Function eregi() is deprecated in <strong>/data/nagios/share/pnp/include/function.inc.php</strong> on line <strong>1505</strong></p>
<p>函数 deprecated 了。。。算了，我决定改php.ini，屏蔽错误和warning！</p>
<p>打开 phpinfo() 看一下php.ini 在哪里，找不到。。。</p>
<p>在 httpd.conf 里加一句：</p>
<p><strong>PHPIniDir &#8220;/data/apache/conf&#8221;</strong></p>
<p>随便copy一个php.ini过来，刚才google了一下，好像是 error_reporting 的问题，但不管我怎么改error_reporting的组合，都无法成功。。。突然被我看到这样的字眼：</p>
<p>display_errors = On</p>
<p>哈哈，还不是你！！把你关了总可以了吧！！</p>
<p>display_errors = Off</p>
<p>apachectl graceful 一下，哈哈，问题解决了！！！可以用了！！继续配置监控。。。</p>
<p>唉，LAMP 如此经典的组合，我了解得还是不够啊！！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/01/19/nagios-pnp-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

