环境:Debian 12 Debian 12 默认的PHP版本为 8.2 如果直接安装php7.4就出现下面的报错: sudo apt-get install libapache2-mod-php7.
环境:Debian 12
Debian 12 默认的PHP版本为 8.2
如果直接安装php7.4就出现下面的报错:
sudo apt-get install libapache2-mod-php7.4 php7.4 php7.4-gd php7.4-opcache php7.4-mbstring php7.4-xml php7.4-JSON php7.4-zip php7.4-curl php7.4-imap php7.4-Mysql php7.4-fpmReading package lists... DoneBuilding dependency tree... DoneReading state infORMation... DonePackage php7.4 is not available, but is referred to by another package.This may mean that the package is missing, has been obsoleted, oris only available from another sourcePackage libapache2-mod-php7.4 is not available, but is referred to by another package.This may mean that the package is missing, has been obsoleted, oris only available from another sourcePackage php7.4-fpm is not available, but is referred to by another package.This may mean that the package is missing, has been obsoleted, oris only available from another sourceE: Package 'libapache2-mod-php7.4' has no installation candidateE: Package 'php7.4' has no installation candidateE: Unable to locate package php7.4-gdE: Couldn't find any package by glob 'php7.4-gd'E: Couldn't find any package by regex 'php7.4-gd'E: Unable to locate package php7.4-opcacheE: Couldn't find any package by glob 'php7.4-opcache'E: Couldn't find any package by regex 'php7.4-opcache'E: Unable to locate package php7.4-mbstringE: Couldn't find any package by glob 'php7.4-mbstring'E: Couldn't find any package by regex 'php7.4-mbstring'E: Unable to locate package php7.4-xmlE: Couldn't find any package by glob 'php7.4-xml'E: Couldn't find any package by regex 'php7.4-xml'E: Unable to locate package php7.4-jsonE: Couldn't find any package by glob 'php7.4-json'E: Couldn't find any package by regex 'php7.4-json'E: Unable to locate package php7.4-zipE: Couldn't find any package by glob 'php7.4-zip'E: Couldn't find any package by regex 'php7.4-zip'E: Unable to locate package php7.4-curlE: Couldn't find any package by glob 'php7.4-curl'E: Couldn't find any package by regex 'php7.4-curl'E: Unable to locate package php7.4-imapE: Couldn't find any package by glob 'php7.4-imap'E: Couldn't find any package by regex 'php7.4-imap'E: Unable to locate package php7.4-mysqlE: Couldn't find any package by glob 'php7.4-mysql'E: Couldn't find any package by regex 'php7.4-mysql'E: Package 'php7.4-fpm' has no installation candidate
安装5.6和7.4正确的姿势为:
sudo apt updatesudo apt install software-properties-common ca-certificates lsb-release apt-transport-httpssudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -sudo apt updatesudo apt-get install libapache2-mod-php5.6sudo apt-get install libapache2-mod-php7.4
多版本切换可以用下面的命令:
sudo update-alternatives --config php
也可以直接在WEB Server里勾选:
2023年7月实测可行
来源地址:https://blog.csdn.net/weinsheimer/article/details/131855546
--结束END--
本文标题: 在Debian 12 上安装 PHP 5.6, 7.4
本文链接: https://lsjlt.com/news/402474.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0