Deepin20 安装 PHP8等环境

Posted sjg20010414

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Deepin20 安装 PHP8等环境相关的知识,希望对你有一定的参考价值。

参考  Debian 10.7安装PHP7.4和PHP8.0 - MichaelShu's Homepage - OSCHINA - 中文开源技术交流社区

sudo apt update
sudo upgrade
sudo apt -y install lsb-release apt-transport-https ca-certificates wget
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list

按前述参考资料操作,这里有问题,因为在 Deepin20 下, lsb_release -sc 得到的是 n/a,即无法获得发行版的代号,Deepin20 是有发行版代号的,这个可以 cat  /etc/lsb-release 查看知道

sjg@sjg-PC:~/Downloads$ cat /etc/lsb-release
DISTRIB_ID=Deepin
DISTRIB_RELEASE=20.2.4
DISTRIB_DESCRIPTION="Deepin 20.2.4"
DISTRIB_CODENAME=apricot

但是,这里不能使用 apricot,我们需要 Deepin 20 对应的 Debian 的代号

sjg@sjg-PC:~/Downloads$ cat /etc/debian_version 
10.10

Debian 10 的代号是 buster,所以, sudo emacs /etc/apt/sources.list.d/php.list  修改成

deb https://packages.sury.org/php/ buster main

然后继续

sudo apt update
sudo apt search php8.0 | grep "/buster"

可以看到可供安装的 php8.0 本身和相关扩展

sudo apt install php8.0
sudo apt install php8.0-{fpm,dev,cli,curl,gd,bcmath,common,redis,ssh2,xml,xmlrpc,intl,soap,mbstring,sqlite3,mysql,pgsql,ldap,opcache,bz2,zip}

然后测试一下,  deepin-editor   index.php  创建测试文件 index.php,内容如下

<?php

phpinfo();

然后  php -S  localhost:8000 启动 web服务,用浏览器查看  http://localhost:8000 即可

 

以上是关于Deepin20 安装 PHP8等环境的主要内容,如果未能解决你的问题,请参考以下文章

Deepin 20配置RIDE环境

Deepin 20系统Linux系统从零打造完美VScode for Python环境

Deepin 20系统Linux系统从零打造完美VScode for Python环境

Ubuntu 20.04 安装微信qq等

Deepin 20系统Linux 系统安装Spark教程及使用

PHP8、FPM及部分扩展编译安装