fedora33 apache无法解析php的问题

  • 按国际惯例,安装好 Apache 和 PHP,但是却发现没法解析PHP文件
yum install httpd
yum install php

不过这次不是Apache配置的问题,而是从 fedora 27 开始,mod_php 就不再是一个默认选项,到了 fedora 33,直接就不再支持 Apache 2.0 Handler 模式来解析 PHP了,要解析的话,只能直接上 php-fpm 了

  • 打开 /etc/httpd/conf.modules.d/00-mpm.conf
# Select the MPM module which should be used by uncommenting exactly
# one of the following LoadModule lines.  See the httpd.conf(5) man
# page for more information on changing the MPM.

# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
#
# NOTE: If enabling prefork, the httpd_graceful_shutdown SELinux
# boolean should be enabled, to allow graceful stop/shutdown.
#
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

# worker MPM: Multi-Processing Module implementing a hybrid
# multi-threaded multi-process web server
# See: http://httpd.apache.org/docs/2.4/mod/worker.html
#
#LoadModule mpm_worker_module modules/mod_mpm_worker.so

# event MPM: A variant of the worker MPM with the goal of consuming
# threads only for connections with active processing
# See: http://httpd.apache.org/docs/2.4/mod/event.html
#
LoadModule mpm_event_module modules/mod_mpm_event.so

由此可见,默认加载的是 event 模式,也就是配合 php-fpm 的模式。

你可能感兴趣的:(fedora33 apache无法解析php的问题)