在 ubuntu 上安裝 PHP //

PHPz
發布: 2024-08-20 06:55:31
原創
700 人瀏覽過

Installing PHP /+ on ubuntu

您可能會遇到類似
的錯誤

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
登入後複製

之後您現在應該可以以 8.3 為例安裝您的 php 版本

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 //的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:dev.to
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!