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;
相关推荐
Aloudata5 小时前
从Apache Atlas到Aloudata BIG,数据血缘解析有何改变?
大数据·apache·数据血缘·主动元数据·数据链路
小钱c712 小时前
Mac下安装Apache JMeter并启动
jmeter·macos·apache
FserSuN2 天前
Apache Calcite - 查询优化之自定义优化规则
apache·calcite
黑风风2 天前
Ubuntu 22 安装 Apache Doris 3.0.3 笔记
笔记·ubuntu·apache
网络安全指导员3 天前
常见网络安全设备默认口令
服务器·网络·安全·web安全·php·apache
Mr_Xuhhh4 天前
Linux第一个小程序-进度条
linux·运维·visualstudio·小程序·编辑器·apache
风口上的吱吱鼠4 天前
20241031 Apache2修改日志里面的时间格式
服务器·apache
小刘同学++4 天前
在 Ubuntu 22.04 上部署Apache 服务, 访问一张照片
linux·ubuntu·apache
cgqyw4 天前
Apache 负载均衡详细配置步骤
运维·apache·负载均衡
Mitch3115 天前
【环境搭建】Apache Kylin 各个版本Docker搭建汇总
docker·apache·kylin