GNU/Linux >> LINUX-Kenntnisse >  >> Ubuntu

Installieren Sie PHP 7 auf einem neuen Ubuntu VPS:[Fix] Paket PHP kann nicht gefunden werden

Kürzlich stellte einer meiner Kunden einen neuen VPS zur Verfügung und bat mich, PHP 7, Apache und MySQL zu installieren. Während der Installation von PHP bin ich auf den folgenden Fehler gestoßen:

root@webimage:~# apt-get install php
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php

Lösung :Standardmäßig ist PHP5.5 nur für Ubuntu Trusty in den Standard-Ubuntu-Repositories verfügbar. Sie können also die PHP 5.5-Version wie unten gezeigt installieren:

#apt-get install php5

Wie installiere ich PHP 7?

Wenn Sie PHP 7 installieren möchten und dasselbe nicht im standardmäßigen Ubuntu Trusty-Repository verfügbar ist. Dann müssen Sie das entsprechende Repository hinzufügen, das PHP 5.6 und höhere Versionen enthält.

Fügen Sie die folgenden Repositorys in Ihrem Ubuntu hinzu:

root@webimage:~# add-apt-repository ppa:ondrej/php
 Co-installable PHP versions: PHP 5.6, PHP 7.0, PHP 7.1 and most requested extensions are included.
 PLEASE DON'T USE PHP 5.4 OR PHP 5.5. The PHP 5.5 and later are no longer supported with security updates, therefore they are not included in this repository.
 You can get more information about the packages at https://deb.sury.org
 BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting
 PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
 WARNING: add-apt-repository is broken with non-UTF-8 locales, see https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
 # LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
 Press [ENTER] to continue or ctrl-c to cancel adding it
 gpg: keyring `/tmp/tmp16acixb1/secring.gpg' created
 gpg: keyring `/tmp/tmp16acixb1/pubring.gpg' created
 gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
 gpg: /tmp/tmp16acixb1/trustdb.gpg: trustdb created
 gpg: key E5267A6C: public key "Launchpad PPA for OndÅej Surý" imported
 gpg: Total number processed: 1
 gpg: imported: 1 (RSA: 1)
 OK

Sie müssen das Repository aktualisieren

#apt-get update

Wie bereits erwähnt, können Sie die PHP-Versionen 5.6, 7.0 und 7.1 wie folgt installieren:

Zur Installation von PHP 5.6

#apt-get install php5.6

Zur Installation von PHP 7.0

# apt-get install php7.0

Zur Installation von PHP 7.1

# apt-get install php7.1

Jetzt können Sie mit Ihren entsprechenden PHP-Versionen arbeiten.


Ubuntu
  1. Kann Mariadb nicht auf Ubuntu 20.04 installieren?

  2. So installieren Sie PyroCMS auf einem Ubuntu 14.04 VPS

  3. So installieren Sie CS-Cart v4 auf einem Ubuntu 14.04 VPS

  4. So installieren Sie Group-Office 6 auf einem Ubuntu 14.04 VPS

  5. So installieren Sie Collabtive 2.1 auf einem Ubuntu 14.04 VPS

So installieren Sie PHP unter Ubuntu 18.04

So installieren Sie PHP unter Ubuntu 20.04

So installieren Sie PHP 8.0 auf Ubuntu 20.04

Fehlerbehebung „E:Paket kann nicht gefunden werden“ Fehler auf Ubuntu [Anfänger-Tutorial]

So installieren Sie PHP 8.0 unter Ubuntu 20.04 / 18.04

So installieren Sie PHP unter Ubuntu 22.04