<?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; cli</title>
	<atom:link href="http://www.sunboyu.cn/tag/cli/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>被困难压住了！</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 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>
	</channel>
</rss>

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