<?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>ubuntu,debian,redhat -linuxany.com &#187; cgi</title>
	<atom:link href="http://www.linuxany.com/archives/tag/cgi/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxany.com</link>
	<description></description>
	<lastBuildDate>Thu, 26 Jan 2012 08:59:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Python CGI调试的2两种方法</title>
		<link>http://www.linuxany.com/archives/1449.html</link>
		<comments>http://www.linuxany.com/archives/1449.html#comments</comments>
		<pubDate>Mon, 03 Jan 2011 06:41:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[dict]]></category>
		<category><![CDATA[sprintf]]></category>
		<category><![CDATA[traceback]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1449</guid>
		<description><![CDATA[第1种：直接输出标准错误 #linuxany_cgi.py import&#160;sys sys.stderr = sys.stdout &#160; def&#160;main(): &#160; &#160; import&#160;cgi &#160; &#160; # ...do the actual work of the CGI... &#160; &#160; # perhaps ending with: &#160; &#160; print&#160;template % script_dictionary &#160; print&#160;&#34;Content-type: text/html\n\n&#34; main() 第2种：记录错误信息到日志文件 import sys, traceback print&#160;&#34;Content-type: text/html\n\n&#34; try:&#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160; # use explicit exception handling &#160; [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1449.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python cgi调试的2种方法</title>
		<link>http://www.linuxany.com/archives/1448.html</link>
		<comments>http://www.linuxany.com/archives/1448.html#comments</comments>
		<pubDate>Mon, 03 Jan 2011 06:36:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[cgi]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1448</guid>
		<description><![CDATA[Formatting sprintf()-style in Python print &#34;&#34;&#34;&#60;html&#62;&#60;head&#62; &#60;title&#62;%s&#60;/title&#62; &#60;/head&#62;&#60;body&#62; &#60;h1&#62;Famous irrational numbers&#60;/h1&#62; &#60;dl&#62;&#60;dt&#62;Pi&#60;/dt&#62; &#160; &#160; &#60;dd&#62;%2.3f&#60;/dd&#62; &#160; &#160; &#60;dt&#62;Square-root of 2&#60;/dt&#62; &#160; &#160; &#60;dd&#62;%2.3f&#60;/dd&#62;&#60;/dl&#62; &#60;/body&#62;&#60;/html&#62;&#34;&#34;&#34; % (&#34;linuxany.com-website&#34;, 3.1415, 1.4142) Dictionary sprintf()-style in Python mydict = {&#34;title&#34;:&#34;linuxany.com-website&#34;, &#160; &#160; &#160; &#160; &#160; &#34;pi&#34;: 3.1415, &#34;e&#34;: 2.7182, &#160; &#160; &#160; &#160; &#160; &#34;sqrt3&#34;: 1.73205, &#34;sqrt2&#34;: 1.4142} template = [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1448.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python CGI中两种风格的字符串格式化</title>
		<link>http://www.linuxany.com/archives/1446.html</link>
		<comments>http://www.linuxany.com/archives/1446.html#comments</comments>
		<pubDate>Mon, 03 Jan 2011 06:32:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[dict]]></category>
		<category><![CDATA[sprintf]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1446</guid>
		<description><![CDATA[Formatting sprintf()-style in Python print &#34;&#34;&#34;&#60;html&#62;&#60;head&#62; &#60;title&#62;%s&#60;/title&#62; &#60;/head&#62;&#60;body&#62; &#60;h1&#62;Famous irrational numbers&#60;/h1&#62; &#60;dl&#62;&#60;dt&#62;Pi&#60;/dt&#62; &#160; &#160; &#60;dd&#62;%2.3f&#60;/dd&#62; &#160; &#160; &#60;dt&#62;Square-root of 2&#60;/dt&#62; &#160; &#160; &#60;dd&#62;%2.3f&#60;/dd&#62;&#60;/dl&#62; &#60;/body&#62;&#60;/html&#62;&#34;&#34;&#34; % (&#34;linuxany.com-website&#34;, 3.1415, 1.4142) Dictionary sprintf()-style in Python mydict = {&#34;title&#34;:&#34;linuxany.com-website&#34;, &#160; &#160; &#160; &#160; &#160; &#34;pi&#34;: 3.1415, &#34;e&#34;: 2.7182, &#160; &#160; &#160; &#160; &#160; &#34;sqrt3&#34;: 1.73205, &#34;sqrt2&#34;: 1.4142} template = [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1446.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache CGI程序的简单配置与使用</title>
		<link>http://www.linuxany.com/archives/1282.html</link>
		<comments>http://www.linuxany.com/archives/1282.html#comments</comments>
		<pubDate>Wed, 26 May 2010 12:19:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[scriptalias]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1282</guid>
		<description><![CDATA[添加虚拟主机 &#60;virtualhost 127.0.0.1:50001&#62;&#60;/virtualhost&#62; 这里新添加了50001端口来进行监听，所以还需要添加监听端口号 Listen 50001要让程序能正常运行，还得通过配置ScriptAlias来允许服务器在指定的情况下，以CGI方式运行。 &#60;virtualhost 127.0.0.1:50001&#62;ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/&#60;/virtualhost&#62; 所以上述的配置会告诉apache，所以以/cgi-bin/开头的资源都会被映射到/usr/local/apache/cgi-bin/目录下，并被认为是cgi程序。然后重启服务器 在apache/cgi-bin/目录里有一些测试例子，我们可能用它来测试下，看看配置是否能正常运行。 比如说apache/cgi-bin/目录下有个test-cgi程序，源码如下： #!/bin/sh&#160;# This article come from linxuany.comset -f&#160;echo &#34;Content-type: text/plain; charset=iso-8859-1&#34;echo&#160;echo CGI/1.0 test script report:echo&#160;echo argc is $#. argv is &#34;$*&#34;.echo&#160;echo SERVER_SOFTWARE = $SERVER_SOFTWAREecho SERVER_NAME = $SERVER_NAMEecho GATEWAY_INTERFACE = $GATEWAY_INTERFACEecho SERVER_PROTOCOL = $SERVER_PROTOCOLecho SERVER_PORT = $SERVER_PORTecho REQUEST_METHOD = $REQUEST_METHODecho HTTP_ACCEPT = &#34;$HTTP_ACCEPT&#34;echo PATH_INFO [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1282.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

