Common Gateway Interface (CGI) is the specification for external programs when the Web server is running. Programs written according to CGI can extend server functions. (Recommended learning: swoole video tutorial)
CGI applications can interact with the browser, and can also communicate with external data sources such as database servers through data APIs, and obtain them from the database servers. data.
After formatting into an HTML document, send it to the browser. You can also put the data obtained from the browser into the database. Almost all servers support CGI, and CGI can be written in any language, including popular C, C++, Java, VB and Delphi. CGI is divided into two types: standard CGI and indirect CGI.
Standard CGI uses command line parameters or environment variables to represent the server's detailed requests, and the server and browser communicate using standard input and output. Indirect CGI, also known as buffered CGI, inserts a buffer program between the CGI program and the CGI interface. The buffer program and the CGI interface communicate using standard input and output.
Swoole is a PHP asynchronous network communication engine for production environments, allowing PHP developers to write high-performance asynchronous concurrent TCP, UDP, Unix Socket, HTTP, and WebSocket services.
Swoole can be widely used in the Internet, mobile communications, enterprise software, cloud computing, online games, Internet of Things (IOT), Internet of Vehicles, smart homes and other fields. Using PHP Swoole as a network communication framework can greatly improve the efficiency of enterprise IT R&D teams.
Swoole is not a framework like Zend Framework, CakePHP, Yii, symfony, ThinkPHP, etc., nor is it a project on par with open source products such as WordPress, Drupal, Discuz, UChome, etc.
Swoole’s goal is to challenge first-class frameworks such as Java frameworks, Ruby On Rails, Python DjangoPylons, etc.
Running environment: Linux Windows Mac FreeBSD Unix
PHP version support: PHP5.3
Supported databases: MS SQL Server, MySQL, IBM DB2, Oracle, Interbase, SQLite, PostgreSQL, ODBC
Supported running modes: Web, Cli command line script, PHP-GTK GUI.
The above is the detailed content of The difference between swoole and cgi. For more information, please follow other related articles on the PHP Chinese website!