• 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

    1. root@fv-az1492-145:/tmp# sudo apt install libapache2-mod-php
    2. Reading package lists... Done
    3. Building dependency tree
    4. Reading state information... Done
    5. Some packages could not be installed. This may mean that you have
    6. requested an impossible situation or if you are using the unstable
    7. distribution that some required packages have not yet been created
    8. or been moved out of Incoming.
    9. The following information may help to resolve the situation:
    10. The following packages have unmet dependencies:
    11. libapache2-mod-php : Depends: libapache2-mod-php7.4 but it is not going to be installed
    12. E: Unable to correct problems, you have held broken packages.
    13. root@fv-az1492-145:/tmp#
    14. root@fv-az1492-145:/tmp# sudo apt install libapache2-mod-php7.4
    15. Reading package lists... Done
    16. Building dependency tree
    17. Reading state information... Done
    18. Some packages could not be installed. This may mean that you have
    19. requested an impossible situation or if you are using the unstable
    20. distribution that some required packages have not yet been created
    21. or been moved out of Incoming.
    22. The following information may help to resolve the situation:
    23. The following packages have unmet dependencies:
    24. 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
    25. E: Unable to correct problems, you have held broken packages.
    26. 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模式:

    1. root@fv-az1492-145:/etc/apache2# ls -al /etc/apache2/conf-available/*php*
    2. -rw-r--r-- 1 root root 1139 Sep 2 08:03 /etc/apache2/conf-available/php7.4-cgi.conf
    3. -rw-r--r-- 1 root root 1278 Sep 2 08:03 /etc/apache2/conf-available/php7.4-fpm.conf
    4. -rw-r--r-- 1 root root 1139 Sep 2 08:04 /etc/apache2/conf-available/php8.0-cgi.conf
    5. -rw-r--r-- 1 root root 1278 Sep 2 08:04 /etc/apache2/conf-available/php8.0-fpm.conf
    6. -rw-r--r-- 1 root root 1282 Oct 27 14:00 /etc/apache2/conf-available/php8.1-cgi.conf
    7. -rw-r--r-- 1 root root 1431 Oct 27 14:00 /etc/apache2/conf-available/php8.1-fpm.conf
    8. -rw-r--r-- 1 root root 1282 Oct 26 17:33 /etc/apache2/conf-available/php8.2-cgi.conf
    9. -rw-r--r-- 1 root root 1431 Oct 26 17:33 /etc/apache2/conf-available/php8.2-fpm.conf
    10. root@fv-az1492-145:/etc/apache2#
    11. root@fv-az1492-145:/etc/apache2# cat /etc/os-release
    12. NAME="Ubuntu"
    13. VERSION="20.04.6 LTS (Focal Fossa)"
    14. ID=ubuntu
    15. ID_LIKE=debian
    16. PRETTY_NAME="Ubuntu 20.04.6 LTS"
    17. VERSION_ID="20.04"
    18. HOME_URL="https://www.ubuntu.com/"
    19. SUPPORT_URL="https://help.ubuntu.com/"
    20. BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    21. PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    22. VERSION_CODENAME=focal
    23. UBUNTU_CODENAME=focal
    24. root@fv-az1492-145:/etc/apache2# uname -a
    25. 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
    26. root@fv-az1492-145:/etc/apache2#

    1. a2enmod proxy_fcgi;
    2. a2enconf php7.4-fpm;
    3. systemctl restart apache2;

  • 相关阅读:
    高速电路设计----第三章
    D. Empty Graph(贪心/二分)
    从不均匀性角度浅析AB实验
    PHP正则表达式(匹配手机号码、邮箱、img中的src值)
    Linux云服务环境安装-JDK篇
    7-20 插松枝
    C# 委托详解
    Codeforces 1696E. Placing Jinas 高维前缀和、组合数取模
    web 面试高频考点 —— JavaScript-Web-API 篇(二)AJAX、存储
    [ffmpeg] 解码
  • 原文地址:https://blog.csdn.net/qq_29060627/article/details/134223903