登录
首页 >  文章 >  php教程

在 ubuntu 上安装 PHP //

来源:dev.to

时间:2024-08-21 15:54:53 472浏览 收藏

珍惜时间,勤奋学习!今天给大家带来《在 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

本篇关于《在 ubuntu 上安装 PHP //》的介绍就到此结束啦,但是学无止境,想要了解学习更多关于文章的相关知识,请关注golang学习网公众号!

声明:本文转载于:dev.to 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>