logo

  • Hỏi Đáp
  • Kiến Thức
  • Sức Khỏe
  • Tử Vi
  • Công Nghệ
No Result
View All Result
logo
No Result
View All Result
Trang chủ install the latest php on ubuntu 20

Install the latest php on ubuntu 20

by Admin _ June 11, 2022

PHP is a programming language used for developing website applications. You must install PHP packages on a Ubuntu system khổng lồ run the application written on it. Generally, it is used to create e-commerce websites, blogs, and API applications.

Bạn đang xem: Install the latest php on ubuntu 20

We will use the Ondrej PPA for installing PHP on Ubuntu 22.04 LTS system. Which contains PHP 8.1, 8.0, 7.4, 7.3, 7.2. 7.1, 7.0 & PHP 5.6 packages. You can install any of them version as required for your application. The new application developers are suggested lớn use latest PHP version ie PHP 8.1.

In this tutorial, you will learn how to lớn install PHP on Ubuntu 22.04 LTS system. This tutorial is also compatible with Ubuntu 20.04, và 18.04 systems.

Before We Begin

First, login khổng lồ the Ubuntu 22.04 via console. Then update the Apt cache và upgrade the current packages of system using the following command:

sudo apt update && sudo apt tăng cấp When prompted, press ‘y’ khổng lồ confirm the installation.

Installing PHP on Ubuntu 22.04

PHP installation on Ubuntu systems is pretty straightforward. You just need to showroom the required PPA and you can install any PHP version on the Ubuntu system.

Follow these steps to complete PHP installation on Ubuntu:

Install few dependencies required by this tutorial with the below-mentioned command:

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https địa chỉ cửa hàng the Ondrej PPA to your system, which contains all versions of PHP packages for the Ubuntu systems.LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php Now, update the Apt package manager cache.sudo apt update The SURY repository contains PHP 8.1, 8.0, 7.4, 7.3, 7.2. 7.1, 7.0 & PHP 5.6. As the latest stable version of PHP is 8.0, but a large number of websites still required PHP 7. You can install any of the required PHP versions on your system.

Xem thêm: Hướng Dẫn Tất Cả Cách Làm Đẹp Sau Sinh Cho Mẹ Bầu Cực Hiệu Quả

Install PHP 8.1: sudo apt install php8.1 Install PHP 7.4: sudo apt install php7.4 Install PHP 5.6 (EOL): sudo apt install php5.6 Replace version 8.1, 7.4, or 5.6 with the required PHP version khổng lồ install on Ubuntu. Even you can install multiple PHP versions on a single Ubuntu system.Some applications required other PHP extensions, that can also be added using below-mentioned syntax:sudo apt install php8.1-Replace with the extension you want lớn install, if you want to add multiple extensions then include them in braces, I am going to lớn install “php-mbstring, php-mysql, php-xml, và php-curl” by running the below-mentioned command:

sudo apt install php8.1-mysql php8.1-mbstring php8.1-xml php8.1-curl Users have installed different PHP version, need to replace 8.1 with required PHP versions.

Check Active PHP Version

Now after installation verify that the correct version of PHP is installed by checking the version number by the below-mentioned command:

php -v

About PHP Configuration Files

Configuration files are stored under a directory with version number under /etc/php directory. For example PHP 8.1 configuration files located as below:

Main PHP configuration tệp tin location:PHP CLI: /etc/php/8.1/cli/php.ini Apache: /etc/php/8.1/apache2/php.ini PHP FPM: /etc/php/8.1/fpm/php.ini All the installed PHP modules are stored under /etc/php/8.1/mods-available directory. PHP Active modules configuration directory location:PHP CLI: /etc/php/8.1/cli/conf.d/ Apache: /etc/php/8.1/apache2/conf.d/ PHP FPM: /etc/php/8.1/fpm/conf.d/

To kiểm tra files for the other PHP versions, just change the PHP version number (8.1 in the above example) in the files and directory path.

Switch default PHP Version for CLI

You can use update-alternatives command lớn set the default PHP version. Use this tutorial to lớn read more details about switching PHP version for CLI & Apache.

sudo update-alternatives --config phpThere are 4 choices for the alternative php (providing /usr/bin/php). Selection Path Priority Status------------------------------------------------------------* 0 /usr/bin/php8.1 81 tự động hóa mode 1 /usr/bin/php5.6 56 manual mode 2 /usr/bin/php7.4 74 manual mode 3 /usr/bin/php8.0 80 manual mode 4 /usr/bin/php8.1 81 manual modePress lớn keep the current choice<*>, or type selection number: 2The above output shows all the installed PHP versions on your system. Selection number 2 set PHP 7.4 as the mặc định PHP version for the command line.

Uninstalling PHP

If any PHP version is no more required, can be removed from the system. That will không tính phí the disk space as well as system security.

To uninstall any PHP version just type:

sudo apt remove php5.6 Also uninstall all the modules for that version with the following command:

sudo apt remove php5.6-*

Conclusion

This tutorial provides you with the instructions to install PHP on Ubuntu 22.04. The Ondrej PPA allows us khổng lồ quickly install PHP on Ubuntu systems. It also allows us to install multiple PHP versions on a single system. You can switch to lớn any PHP version as mặc định anytime with the update-alternative utility.

Share Tweet Linkedin Pinterest
Previous Post

Tính phần trăm giảm giá php

Next Post

Validate form bằng php

CÙNG CHUYÊN MỤC

form register php

Form register php

09/04/2021
fantastic blog (cms) in php with source code

Fantastic blog (cms) in php with source code

28/04/2021
validate form php javascript

Validate form php javascript

28/04/2021
http diendanlequydon com viewtopic php style 6

Http diendanlequydon com viewtopic php style 6

28/04/2021
cách tính năm nhuận trong php

Cách tính năm nhuận trong php

04/07/2022
bản khai đăng ký tên miền

Bản khai đăng ký tên miền

02/07/2022
phần mềm lập trình php tốt nhất

Phần mềm lập trình php tốt nhất

01/07/2022
ghi file trong php

Ghi file trong php

30/06/2022

Newsletter

The most important automotive news and events of the day

We won't spam you. Pinky swear.

Chuyên Mục

  • Hỏi Đáp
  • Kiến Thức
  • Sức Khỏe
  • Tử Vi
  • Công Nghệ

News Post

  • Bí quyết giảm cân nhanh và hiệu quả

About

Chúng tôi tạo ra trang web nhằm mục đích mang lại kiến thức bổ ích cho cộng đồng, các bài viết được sưu tầm từ nhiều nguồn trên internet giúp mang lại kiến thức khách quan dành cho bạn

©2022 darkedeneurope.com - Website WordPress vì mục đích cộng đồng

Liên Hệ - Giới Thiệu - Nội Quy - Bảo Mật

No Result
View All Result
  • Trang chủ
  • Chuyên mục
    • Hỏi Đáp
    • Kiến Thức
    • Sức Khỏe
    • Tử Vi
    • Công Nghệ
  • Lưu trữ
  • Liên hệ

© 2022 darkedeneurope.com - Website WordPress vì mục đích cộng đồng.