ubuntu20.04下apache启用php7.4-fpm

默认的apache不解析php文件:

直接安装提示依赖有问题:

libapache2-mod-php7.4 : Depends: php7.4-common (= 7.4.3-4ubuntu2.19) but 1:7.4.33-8+ubuntu20.04.1+deb.sury.org+1 is to be installed

root@fv-az1492-145:/tmp# sudo apt install libapache2-mod-php
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache2-mod-php : Depends: libapache2-mod-php7.4 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@fv-az1492-145:/tmp# 



root@fv-az1492-145:/tmp# sudo apt install libapache2-mod-php7.4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache2-mod-php7.4 : Depends: php7.4-common (= 7.4.3-4ubuntu2.19) but 1:7.4.33-8+ubuntu20.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
root@fv-az1492-145:/tmp# 

https://mirrors.aliyun.com/ubuntu/pool/main/p/php7.4/libapache2-mod-php7.4_7.4.3-4ubuntu2.19_amd64.deb

没办法,使用php-fpm模式:

root@fv-az1492-145:/etc/apache2# ls -al /etc/apache2/conf-available/*php*          
-rw-r--r-- 1 root root 1139 Sep  2 08:03 /etc/apache2/conf-available/php7.4-cgi.conf
-rw-r--r-- 1 root root 1278 Sep  2 08:03 /etc/apache2/conf-available/php7.4-fpm.conf
-rw-r--r-- 1 root root 1139 Sep  2 08:04 /etc/apache2/conf-available/php8.0-cgi.conf
-rw-r--r-- 1 root root 1278 Sep  2 08:04 /etc/apache2/conf-available/php8.0-fpm.conf
-rw-r--r-- 1 root root 1282 Oct 27 14:00 /etc/apache2/conf-available/php8.1-cgi.conf
-rw-r--r-- 1 root root 1431 Oct 27 14:00 /etc/apache2/conf-available/php8.1-fpm.conf
-rw-r--r-- 1 root root 1282 Oct 26 17:33 /etc/apache2/conf-available/php8.2-cgi.conf
-rw-r--r-- 1 root root 1431 Oct 26 17:33 /etc/apache2/conf-available/php8.2-fpm.conf
root@fv-az1492-145:/etc/apache2# 
root@fv-az1492-145:/etc/apache2# cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
root@fv-az1492-145:/etc/apache2# uname -a
Linux fv-az1492-145 5.15.0-1050-azure #57~20.04.1-Ubuntu SMP Wed Oct 4 17:09:16 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@fv-az1492-145:/etc/apache2# 

a2enmod proxy_fcgi;
a2enconf php7.4-fpm;

systemctl restart apache2;
相关推荐
Hello.Reader1 小时前
深入解析 Apache APISIX
java·apache
hwscom8 小时前
如何永久解决Apache Struts文件上传漏洞
java·服务器·struts·web安全·apache
白开水2338 小时前
Apache RocketMQ 5.1.3安装部署文档
apache·rocketmq
s甜甜的学习之旅1 天前
Apache POI练习代码
apache
是小崔啊1 天前
开源轮子 - Apache Common
java·开源·apache
程序猿阿伟2 天前
《探索 Apache Spark MLlib 与 Java 结合的卓越之道》
java·spark-ml·apache
开心工作室_kaic2 天前
springboot461学生成绩分析和弱项辅助系统设计(论文+源码)_kaic
开发语言·数据库·vue.js·php·apache
cr.sheeper2 天前
Vulnhub靶场Apache解析漏洞
网络安全·apache
ccc_9wy3 天前
Apache Solr RCE(CVE-2017-12629)--vulhub
apache·solr·lucene·burp suite·vulhub·远程命令执行漏洞rce·cve-2017-12629
ccc_9wy3 天前
Apache Solr RCE(CVE-2019-0193)--vulhub
网络安全·apache·solr·lucene·vulhub·cve-2019-0193·远程命令执行漏洞rce