ubuntu20.04下apache启用php7.4-fpm-CSDN博客

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

默认的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;

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: phpUbuntu