卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章75328本站已运行4311

在 ubuntu 上安装 PHP //

在 ubuntu 上安装 php //

您可能会遇到类似于
的错误

hit:1 http://ng.archive.ubuntu.com/ubuntu lunar inrelease                      
hit:2 http://ng.archive.ubuntu.com/ubuntu lunar-updates inrelease              
hit:3 https://dl.google.com/linux/chrome/deb stable inrelease                  
hit:4 http://ng.archive.ubuntu.com/ubuntu lunar-backports inrelease
ign:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu lunar inrelease
err:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu lunar release
  404  not found [ip: 185.125.190.80 443]
hit:7 http://ng.archive.ubuntu.com/ubuntu lunar-security inrelease
reading package lists... done
e: the repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu lunar release' does not have a release file.
n: updating from such a repository can't be done securely, and is therefore disabled by default.
n: see apt-secure(8) manpage for repository creation and user configuration details.

or 

“reading package lists… done
building dependency tree
reading state information… done
e: unable to locate package php8.2
e: couldn’t find any package by glob ‘php8.2’
e: couldn’t find any package by regex ‘php8.2’”

可能是跑步后

add-apt-repository ppa:ondrej/php

通过运行删除之前的源

sudo add-apt-repository --remove ppa:ondrej/php
sudo apt update

您需要按如下方式编辑您的存储库源文件:

sudo nano /etc/apt/sources.list

然后输入

deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main

然后运行

sudo apt update

之后你现在应该可以安装你的php版本了,以8.3为例

sudo apt install php8.3

如果您已经安装了其他一些php,您可能需要使用
更改为版本

sudo update-alternatives --config php

按照提示操作

您也可以考虑安装以下扩展


sudo apt install php8.3-curl php8.3-gd php8.3-intl php8.3-simplexml php8.3-dom php8.3-mysql php8.3-mbstring php8.3-xml php8.3-gd php8.3-curl php8.3-mysqli php8.3-zip

卓越飞翔博客
上一篇: PHP 函数中引用参数在函数回调中的应用
下一篇: 返回列表
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏