CGI是一个公共网关接口。顾名思义,它是所有东西的“通用”网关接口。从名字上看,它是如此的琐碎和幼稚。我觉得我明白了,每次遇到这个词我都有这种感觉。但坦白说,我没有。我还是很困惑。
我是一个有网页开发经验的PHP程序员。
用户(客户端)请求页面——> webserver(->嵌入式PHP ---->服务器端(PHP)脚本—> MySQL服务器。
现在说我的PHP脚本可以从MySQL服务器和MATLAB服务器和其他服务器获取结果。
PHP脚本是CGI?因为它的接口之间的web服务器和所有其他服务器?我不知道。有时他们称CGI为技术,有时他们称CGI为程序或其他服务器。
What exactly is CGI? Whats the big deal with /cgi-bin/*.cgi? What's up with this? I don't know what is this cgi-bin directory on the server for. I don't know why they have *.cgi extensions. Why does Perl always comes in the way. CGI & Perl (language). I also don't know what's up with these two. Almost all the time I keep hearing these two in combination "CGI & Perl". This book is another great example CGI Programming with Perl. Why not "CGI Programming with PHP/JSP/ASP"? I never saw such things. CGI Programming in C, confuses me a lot. "in C"?? Seriously?? I don't know what to say. I'm just confused. "in C"?? This changes everything. Program needs to be compiled and executed. This entirely changes my view of web programming. When do I compile? How does the program gets executed (because it will be a machine code, so it must execute as a independent process). How does it communicate with the web server? IPC? and interfacing with all the servers (in my example MATLAB & MySQL) using socket programming? I'm lost!! People say that CGI is deprecated and isn't in use anymore. Is that so? What is the latest update?
Once, I ran into a situation where I had to give HTTP PUT request access to web server (Apache HTTPD). Its a long back. So, as far as I remember this is what I did: Edited the configuration file of Apache HTTPD to tell webserver to pass all HTTP PUT requests to some put.php ( I had to write this PHP script) Implement put.php to handle the request (save the file to the location mentioned) People said that I wrote a CGI Script. Seriously, I didn't have a clue what they were talking about.
我真的写了CGI脚本吗?
我希望你能理解我的困惑。(因为我自己也不知道我在哪里感到困惑)。我要求你们的回答尽量简单。我真的不懂任何花哨的专业术语。至少在这种情况下不是。
编辑:
我发现了这个神奇的教程“CGI编程很简单!”- CGI教程,以最简单的方式解释概念。阅读完本文后,您可能想要阅读C语言CGI编程入门,用实际的代码示例来补充您的理解。我还在维基百科的文章中添加了本教程的链接:http://en.wikipedia.org/wiki/Common_Gateway_Interface