中條 美冬

1670335020

Ubuntu 22.04 に複数の PHP バージョンをインストールする

このチュートリアルでは、Ubuntu 22.04 LTSシステムに PHP をインストールする方法を学習します。このチュートリアルは、 Ubuntu 20.04および18.04システムとも互換性があります。

  • ステップ 1: システムの更新
  • ステップ 2: Ubuntu 22.04 に複数の PHP バージョンをインストールする
  • ステップ 3: アクティブな PHP バージョンを確認する
  • ステップ 4: CLI のデフォルトの PHP バージョンを切り替える
  • ステップ 5: PHP バージョンのアンインストール

ステップ 1: システムの更新

まず、 コンソールからUbuntu 22.04にログインします。次に、Apt キャッシュを更新し、次のコマンドを使用してシステムの現在のパッケージをアップグレードします。

sudo apt-get update
sudo apt-get upgrade 

プロンプトが表示されたら、 yを押し てインストールを確認します。

ステップ 2: Ubuntu 22.04 に複数の PHP バージョンをインストールする

PHP の複数のバージョンをインストールする最も簡単な方法は、Debian 開発者である Ondřej Surý の PPA を使用することです。この PPA を追加するには、ターミナルで次のコマンドを実行します。PPA からソフトウェアをインストールする場合は、software-properties-common パッケージが必要です。Ubuntu デスクトップには自動的にインストールされますが、Ubuntu サーバーではインストールされない可能性があります。

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

SURY リポジトリには、PHP 8.1、8.0、7.4、7.3、7.2、7.1、7.0、および PHP 5.6 が含まれています。PHPの最新の安定バージョンは 8.0ですが、多くの Web サイトではまだPHP 7が必要です。必要な PHP バージョンのいずれかをシステムにインストールできます。

PHP 8.1 をインストールします。

PHP8.1 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php8.1 php8.1-fpm

そして、いくつかの一般的なPHP8.1 拡張機能をインストールします。

sudo apt-get install php8.1-mysql php8.1-mbstring php8.1-xml php8.1-gd php8.1-curl

プロンプトが表示されたら、 yを押し てインストールを確認します。

 入力して Tab キーを 2 回押すと、使用可能なすべてのPHP8.1拡張機能を表示できます。sudo apt-get install php8.1

Ubuntu 22.04 に複数の PHP バージョンをインストールする - TechvBlogs

PHP 8.0 をインストールします。

PHP8.0 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php8.0 php8.0-fpm

そして、いくつかの一般的なPHP8.0 拡張機能をインストールします。

sudo apt-get install php8.0-mysql php8.0-mbstring php8.0-xml php8.0-gd php8.0-curl

PHP 7.4 をインストールします。

PHP7.4 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php7.4 php7.4-fpm

そして、いくつかの一般的なPHP7.4 拡張機能をインストールします。

sudo apt-get install php7.4-mysql php7.4-mbstring php7.4-xml php7.4-gd php7.4-curl

プロンプトが表示されたら、 yを押し てインストールを確認します。 

PHP 7.3 をインストールします。

PHP7.3 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php7.3 php7.3-fpm

そして、いくつかの一般的なPHP7.3 拡張機能をインストールします。

sudo apt-get install php7.3-mysql php7.3-mbstring php7.3-xml php7.3-gd php7.3-curl

プロンプトが表示されたら、 yを押し てインストールを確認します。 

PHP 7.2 をインストールします。

PHP7.2 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php7.2 php7.2-fpm

そして、いくつかの一般的なPHP7.2 拡張機能をインストールします。

sudo apt-get install php7.2-mysql php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl

プロンプトが表示されたら、 yを押し てインストールを確認します。 

PHP 7.1 をインストールします。

PHP7.1 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php7.1 php7.1-fpm

そして、いくつかの一般的なPHP7.2 拡張機能をインストールします。

sudo apt-get install php7.1-mysql php7.1-mbstring php7.1-xml php7.1-gd php7.1-curl

プロンプトが表示されたら、 yを押し てインストールを確認します。 

PHP 5.6 をインストールします。

PHP5.6 これで、次のコマンドを実行して Ubuntu にインストールできます。

sudo apt-get install php5.6 php5.6-fpm

そして、いくつかの一般的なPHP5.6 拡張機能をインストールします。

sudo apt-get install php5.6-mysql php5.6-mbstring php5.6-xml php5.6-gd php5.6-curl

プロンプトが表示されたら、 yを押し てインストールを確認します。

ステップ 3: アクティブな PHP バージョンを確認する

インストール後、以下のコマンドでバージョン番号を確認して、正しいバージョンの PHP がインストールされていることを確認します。

php -v
# Output
PHP 8.1.8 (cli) (built: Jul 11 2022 08:30:39) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.8, Copyright (c), by Zend Technologies

ステップ 4: CLI のデフォルトの PHP バージョンを切り替える

Ubuntu 22.04 に複数のバージョンの PHP がインストールされている場合は、いずれかのバージョンをデフォルトの PHP バージョンにすることを選択できます。

利用可能なバージョンを一覧表示するには、次のコマンドを実行します。

sudo update-alternatives --config php

Ubuntu 22.04 に複数の PHP バージョンをインストールする - TechvBlogs

ご覧のとおりPHP 8.1、PHP のデフォルト バージョンは .

デフォルト バージョンを変更するには、デフォルトとして作成する適切なバージョンに一致する番号を入力し、 を押しENTERます。

たとえばPHP 7.4、デフォルト バージョンを作成するには、 を入力3して押しENTERます。

以下のコマンドを実行して、バージョンをすぐに変更できます。

sudo update-alternatives --set php /usr/bin/php7.4

その後、アクティブな PHP バージョンを確認します。

php -v
# Output
PHP 7.4.30 (cli) (built: Jun 27 2022 08:21:19) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies

ステップ 5: PHP バージョンのアンインストール

PHP バージョンが不要になった場合は、システムから削除できます。これにより、ディスク領域とシステム セキュリティが解放されます。

PHP バージョンをアンインストールするには、次のコマンドを実行します。

sudo apt-get remove php5.6

また、そのバージョンのすべてのモジュールをアンインストールし、次のコマンドを実行します。

sudo apt-get remove php5.6-*

What is GEEK

Buddha Community

Shawn  Pieterse

Shawn Pieterse

1625711252

Installing PHP 8.0 on Ubuntu 20.04 and Ubuntu 18.04

Add PHP Repository

  • Update the repository cache.
  • Install the below packages.
  • Add the repository to your system.
  • Update the repository index.

Install PHP
Install PHP 8.0 on Ubuntu 20.04 / Ubuntu 18.04
Install PHP 7.x on Ubuntu 20.04 / Ubuntu 18.04
Verify PHP Version
PHP Support for Web Server
Both Apache and Nginx do not support PHP language by default when the browser requests the PHP page. So, we need to install the PHP module package to support PHP.

#ubuntu #php 8.0 #ubuntu 20.04 #ubuntu 18.04

Chet  Lubowitz

Chet Lubowitz

1595429220

How to Install Microsoft Teams on Ubuntu 20.04

Microsoft Teams is a communication platform used for Chat, Calling, Meetings, and Collaboration. Generally, it is used by companies and individuals working on projects. However, Microsoft Teams is available for macOS, Windows, and Linux operating systems available now.

In this tutorial, we will show you how to install Microsoft Teams on Ubuntu 20.04 machine. By default, Microsoft Teams package is not available in the Ubuntu default repository. However we will show you 2 methods to install Teams by downloading the Debian package from their official website, or by adding the Microsoft repository.

Install Microsoft Teams on Ubuntu 20.04

1./ Install Microsoft Teams using Debian installer file

01- First, navigate to teams app downloads page and grab the Debian binary installer. You can simply obtain the URL and pull the binary using wget;

$ VERSION=1.3.00.5153
$ wget https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams/teams_${VERSION}_amd64.deb

#linux #ubuntu #install microsoft teams on ubuntu #install teams ubuntu #microsoft teams #teams #teams download ubuntu #teams install ubuntu #ubuntu install microsoft teams #uninstall teams ubuntu

How to Install PHP 8.0 on Ubuntu 20.04 / 18.04

PHP is arguably one of the most widely used server-side programming languages. It’s the language of choice when developing dynamic and responsive websites. In fact, popular CM platforms such as WordPressDrupal, and Magento are based on PHP.

At the time of penning down this guide, the latest version of PHP is PHP 8.0. It was released on November 26, 2020. It boasts of new features and optimizations such as union types, named arguments, null safe operator, match expression, JIT, and improvements in error handling and consistency.

This tutorial walks you through the installation of PHP 8.0 on Ubuntu 20.04 / 18.04.

On this page

  • Add the Ondřej Surý PPA Repository on Ubuntu
  • Install PHP 8.0 with Apache on Ubuntu
  • Install PHP 8.0 with Nginx on Ubuntu
  • Install PHP 8 Extensions in Ubuntu
  • Verify PHP 8 Installation in Ubuntu

Step 1: Add the Ondřej Surý PPA Repository

Step 2: Install PHP 8.0 with Apache on Ubuntu

Step 2: Install PHP 8.0 with Nginx on Ubuntu

Step 4: Install PHP 8 Extensions in Ubuntu

Step 5: Verify PHP 8 Installation in Ubuntu

#php #ubuntu #php tips #ubuntu tips

Myah  Conn

Myah Conn

1591066673

2 Ways to Upgrade Ubuntu 18.04/18.10 To Ubuntu 19.04 (GUI & Terminal)

This tutorial is going to you 2 ways to upgrade Ubuntu 18.04 and Ubuntu 18.10 to 19.04. The first method uses the graphical update manger and the second method uses command line. Usually you use the graphical update manager to upgrade Ubuntu desktop and use command line to upgrade Ubuntu server, but the command-line method works for desktops too.

#ubuntu #linux #ubuntu 19.04 #ubuntu desktop #ubuntu server

Alycia  Klein

Alycia Klein

1596719640

How To Install Jenkins on Ubuntu 20.04 / Ubuntu 18.04

Jenkins is an open-source automation server that helps to automate the repetitive tasks involved in the software development process, which includes building, testing, and deployments.

Jenkins was forked from the Oracle Hudson project and written in Java.

Here, we will see how to install Jenkins on Ubuntu 20.04 / Ubuntu 18.04.

Install Jenkins On Ubuntu 20.04

Install Java

Since Jenkins is written in Java, it requires Java 8 or Java 11 to run. Here, I will install the OpenJDK 11 for Jenkins installation.

sudo apt update

sudo apt install -y default-jre apt-transport-https wget

If you want to use the Oracle Java in place of OpenJDK, then use any one of the links to install it.

READ: How To Install Oracle Java on Ubuntu 20.04

READ: How To Install Oracle Java on Ubuntu 18.04

Verify the Java version after the installation.

java -version

Output:

openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

Add Jenkins Repository

Jenkins provides an official repository for its packages. To use the Jenkins repository, first, we will need to add the Jenkins public key to the system.

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

Then, add the Jenkins repository to your system.

echo "deb https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list

Install Jenkins

Install Jenkins package using the apt command.

sudo apt update

sudo apt install -y jenkins

The Jenkins service should now be up and running. You can check the status of the Jenkins service using the below command.

sudo systemctl status jenkins

#ubuntu #jenkins #ubuntu 18.04 #ubuntu 20.04