简体   繁体   中英

Difference between PHP, Java Servlet and traditional CGI program

I learned that program that handle GET/POST request are usually CGI programs. This definition is too board. Can anyone tell me what exactly a CGU program is? CGI programs handle GET/POST method, but Java servlets and PHP can do that too, so what is the difference between PHP and traditional CGI program; Java servlet and CGI program?

I learned that program that handle GET/POST request are usually CGI programs.

No, they aren't. They used to be, but CGI is no longer the "usual" method.

Can anyone tell me what exactly a CGI program is?

CGI is a standard way for a web server to run a piece of software, pass data to it (such as the URL and the body of a POST request), and then read data back from the program to use as the HTTP response.

Java servlets and PHP can do that too

A servlet is a different way of doing the same job, but is Java specific.

PHP is a programming language. You can use CGI to run a program written in PHP (although mod_php is more common).

CGI program is a program that utilize CGI protocol.

Dunno for the servlet but the same PHP code can be run as CGI, FastCGI, php-fpm, apache module, isapi filter and some other ways I believe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM