ubuntu20.04下apache启用php7.4

编程入门 行业动态 更新时间:2024-10-26 19:32:36

ubuntu20.04下<a href=https://www.elefans.com/category/jswz/34/1769910.html style=apache启用php7.4"/>

ubuntu20.04下apache启用php7.4

默认的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+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+1 is to be installed
E: Unable to correct problems, you have held broken packages.
root@fv-az1492-145:/tmp# 
.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="/"
SUPPORT_URL="/"
BUG_REPORT_URL="/"
PRIVACY_POLICY_URL=""
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;

更多推荐

ubuntu20.04下apache启用php7.4

本文发布于:2023-11-16 16:52:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628211.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!