Â
Â
Â
Â
Â
Â
ã ãããã¤ã³ã¿ã¼ãããã§python/ãã¤ã½ã³ãåããã¦ã¿ã ã
Â
ã¨ããäºæ ããpythonã¨ãããããã°ã©ã è¨èªãããããããªã£ããã ãã©ã
æè¡åãç¥èããªãç§ã«ã¤ã³ã¹ãã¼ã«ä½æ¥ã¨ãæ£ç´ãããè¦æã»ã»ã»
Â
ãããä»åãã¦ãããããã¤ã³ã¿ã¼ãããã®ã¬ã³ã¿ã«ãµã¼ãã¼ã«
ãã¤ã½ã³ããã¤ã³ã¹ãã¼ã«ããã¦ãã°ãªãã»ã»ã»
Â
ã£ã¦æã£ããããã¦ããã
Â
ãã£ã¨phpããããã£ã¦ãªãã£ããã©ã
Â
ãããããã ã
Â
 ããããã¨ãããããããã¡ã
Â
ã£ã¦ãã¨ã§ããã£ããHello Worldããã ãã¦ããããï¼
ã£ã¦æã£ããã©ã
webã«ãããã¦ã¯phpãã触ã£ã¦ãªãã£ãã®ã§
ãªã«ãã©ãããã°ããã®ããä¸åä¸æã
Â
ã°ã¼ã°ã«ããã«ãå°ãããã¨ã
ããããªãµã¤ããããã»ã»ã»ã
Â
ãããã§ã·ã³ãã«ãªPYTHON CGIãåããã¦ã¿ãï¼ç°å¢è¨å®ç·¨ï¼
Â
ãã®ãµã¤ãæ§ã®æé éããã£ã¦ã¿ããã©ã»ã»ã»
ãªãã
ã¤ã³ã¿ã¼ãã«ãµã¼ãã¼ã¨ã©ã¼500
Â
ããããã£ã¦ãã¨ã§ããã«ã°ã°ãã
Â
ãã¼ãæ¸ãã¦ãããã¨ã®ï¼å²ãããããªããã©ã
Â
ãµãã¤ã®æé ããã£ã³ãã³ãã¦ã¿ãã
Â
ã¨ã«ãããHelloWorldããã§ãã°ããã§ãããã§ãããããã
Â
ã¨ããããã¨ã§åºããã
http://whatsjp.com/gadget/sandbox/helloworld.cgi
Â
ãããã¨åãããã«ãããã¤ã³ã¿ã¼ãããã§pythonã«HelloWorldããã ããªã人ã¯ã
以ä¸ã®æé ãè¸ãã¨å¹¸ãã«ãªããããããã¾ããã
Â
ãæé ã
ï¼ï¼www以ä¸ã®å¥½ããªå ´æã«ãã©ã«ããç¨æ
ä¾ www/cgi/
Â
ï¼ï¼ã¤ãã£ããã©ã«ãã«.htaccessãã¡ã¤ã«ãã¤ãã£ã¦ä»¥ä¸ãæ¸ã
AddHandler cgi-script cgi
Â
ï¼ï¼ãã©ã«ãã«helloworld.cgiãã¡ã¤ã«ãä½ã£ã¦ä»¥ä¸ãæ¸ã
#!/usr/local/bin/python
print ('Content-type: text/html; charset=UTF-8')
print ("\r\n\r\n")
print ("Hello world")
Â
â»ããã§è¦æ³¨æï¼
ãã¡ã¤ã«ã®æåã³ã¼ãã¯UTF-8ã§æ¹è¡ã¯ãLFã
ç§ä¸¸ãªãããã¡ã¤ã«ãã¡ãã¥ã¼ã®ã¨ã³ã³ã¼ãã®ç¨®é¡ã§è¨å®ã§ãã¾ãã
Â
ï¼ï¼www/cgi以ä¸ã®ãã¼ããã·ã§ã³ã705ã«ãã
Â
ï¼ï¼helloworld.cgiã«ãã©ã¦ã¶ã§ã¢ã¯ã»ã¹ãã
ä¾ http://ã»ãã»ã.com/cgi/holloworld.cgi
Â
ããã§ãHello Worldãã¨è¡¨ç¤ºããã¦ããã¨æãã¾ãã
Â
âãããªæããï¼ãã¡ã¤ã«ã¯ããã«æ¶ããããããªãã§ããï¼
http://whatsjp.com/gadget/sandbox/helloworld.cgi
Â
以å¤ã«ãã¾ã£ããæ å ±ããªãã£ãã®ã§ã
ãããåãæ©ã¿ã®ã²ã¨ã®å¾¡å½¹ã«ãã¦ããªã幸ãã§ãã
Â
ãã¼ã¢ã¢ã¼ãã¤ãã ã¨ã¼ãã¤ã½ã³ï¼
Â
Â