当前位置: 首页 > news >正文

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;

http://www.lryc.cn/news/217947.html

相关文章:

  • 在 CentOS 服务器上部署 JAR 文件到 Docker 容器
  • vector类模拟实现(c++)(学习笔记)
  • Redis Sentinel 哨兵模式
  • 实用篇-MQ消息队列
  • springboot打包时依赖jar和项目jar分开打包;jar包瘦身
  • 嵌入式系统的元素
  • 提升ChatGPT答案质量和准确性的方法Prompt engineering实用的prompt灵感和技巧
  • [Machine Learning] Learning with Noisy Labels
  • 集简云slack(自建)无需API开发轻松连接OA、电商、营销、CRM、用户运营、推广、客服等近千款系统
  • Idea 对容器中的 Java 程序断点远程调试
  • vscode设置保存后,自动格式化代码
  • datagrip出现 java.net.ConnectException: Connection refused: connect.
  • Docker 安装ELK7.7.1
  • 决策树算法
  • maven之pom文件详解
  • 深度学习之基于Python+OpenCV+dlib的考生信息人脸识别系统(GUI界面)
  • 创建javaEE项目(无maven),JSP(九大内置对象)、Servlet(生命周期)了解
  • BIOS开发笔记 - HDA Audio
  • C语言——选择排序
  • vue详细安装教程
  • Java 正则表达式字符篇
  • shell脚本代码混淆
  • 【MATLAB第81期】基于MATLAB的LSTM长短期记忆网络预测模型时间滞后解决思路(更新中)
  • 订单业务和系统设计(一)
  • 安全模型的分类与模型介绍
  • I/O多路转接之select
  • “如何对TXT文件的内容进行连续行删除?实现一键文件整理!
  • stable diffusion公司发布4款LLM大语言模型,为何大家都喜爱LLM?
  • 堆排序--C++实现
  • 【数据结构】数组和字符串(十四):字符串匹配1:朴素的模式匹配算法(StringMatching)