Running Php files on Apache requires mod_php to be enabled on the server. It allows Apache to parse .Php files. mod_php can interpret Php code in apache and send HTML to the web server.
If mod_php is enabled on the server, there will be a file called php in the /etc/httpd/conf.d/ directory .conf file. (Recommended learning: Apache server)
You can also view:
httpd -M | grep "php5_module"
The output is similar to the following:
Php handler in Apache The commonly used Php handlers in Apache are the following -
mod_php
CGI
FastCGI
suPHP
mod_php is the oldest PHP process program, which makes PHP part of apache and does not call any external PHP process. This module is installed by default in every Linux distribution repository, so enabling/disabling this module is very simple.
If you use FastCGI as your PHP handler, you can set up multiple versions of PHP for use by different accounts on the server.
FastCGI, mod_fastcgi, is an extension of mod_fcgid, where mod_fcgid is a high-performance alternative to CGI, mod_cgi. It starts a sufficient number of CGI instances to handle concurrent web requests. It also uses suexec to support different users using their own PHP instances and improve web security.
The above is the detailed content of How can Apache support PHP programs?. For more information, please follow other related articles on the PHP Chinese website!