What is the difference between PHP as CGI and as an "Apache Module"?

When PHP is used as a CGI (Common Gateway Interface), each request for a PHP script spawns a new PHP process. This can lead to higher resource usage and slower performance compared to using PHP as an Apache module, where PHP is loaded directly into Apache and processes requests more efficiently. To switch from using PHP as a CGI to an Apache module, you will need to configure your Apache server to load the PHP module and disable any existing CGI configuration. ```apache # Disable PHP CGI <IfModule mod_php7.c> # Load PHP module LoadModule php7_module modules/libphp7.so </IfModule> ```