


How to install php7.2, php7.3, php7.4 in Ubuntu? (Detailed explanation of method)
Works with any Ubuntu version and other Ubuntu-based versions. Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04 or even Ubuntu 19.10.
Before you begin
PHP has different versions and distributions that you can use. The current PHP official website supports the oldest version (PHP 7.2) to PHP 7.3 and the latest version (PHP 7.4).
This blog provides instructions for PHP 7.4, PHP 7.2 (the default in Ubuntu 18.04), and the default PHP version (PHP 7) in the Ubuntu 16.04 repository.
It is recommended that you install PHP 7.3 because it is stable and has many improvements and new features. If you are still using PHP 7.1, you will definitely need to upgrade as soon as possible, as its security support will end at the end of 2019.
Install PHP 7.4 on Ubuntu 18.04 or 16.04
PHP 7.4 is the latest version of PHP with many improvements. These instructions are very similar to PHP 7.3.
Update Ubuntu
First, update your Ubuntu server:
apt-get update && apt-get upgrade
Add PHP Storage Repository
To install PHP 7.4, you need to use a third-party repository. We will use the repository of Ondřej Surý that we have used again before.
First, make sure you have the following packages installed so you can add the repository:
apt-get install software-properties-common
Next, add the PHP repository from Ondřej:
add-apt-repository ppa:ondrej/php
Finally, update the installation Package:
apt-get update
Install PHP 7.4
After adding the repository, you can install PHP 7.4 using the following command:
apt-get install php7.4
This command will install additional packages:
libapache2-mod-php7.4
libaprutil1-dbd-sqlite3
php7.4-cli
php7.4-common
php7.4-json
php7.4-opcache
php7.4-readline
Wait...
That’s it . To check if PHP 7.4 is installed on your server, run the following command:
php -v
Install PHP 7.4 Modules
Depending on your application, you may need additional packages and modules. The most commonly used modules can be installed using the following command:
apt-get install php-pear php7.4-curl php7.4-dev php7.4-gd php7.4-mbstring php7.4-zip php7.4-mysql php7.4-xml
Just like that, you can start using PHP on your Ubuntu server.
Installing PHP 7.2 on Ubuntu 16.04
PHP 7.2 is the stable version of PHP with many new features, improvements, and bug fixes. If you want a better and faster website/app, you should definitely use it.
Update Ubuntu
Of course, as always, update Ubuntu first:
apt-get update && apt-get upgrade
Add PHP Storage Repositories
You can use third-party repositories to install the latest version of PHP. We will use Ondřej Surý’s repository.
First, make sure you have the following packages installed so you can add the repository:
apt-get install software-properties-common
Next, add the PHP repository from Ondřej:
add-apt-repository ppa:ondrej/php
Finally, update the installation Package:
apt-get update
Install PHP 7.2
After adding the repository, you can install PHP 7.2 using the following command:
apt-get install php7.2
This command will install additional packages:
ibapache2-mod-php7.2
libargon2-0
libsodium23
libssl1.1
php7.2-cli
- ##php7 .2-common
- php7.2-json ##php7.2-opcache
- php7.2-readline
- That’s it. To check if PHP 7.2 is installed on your server, run the following command:
php -v
Install PHP 7.2 ModuleAccording to your application, You may need other packages and modules. The most commonly used modules can be installed using the following command:
apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
Just like that, you can start using PHP on your Ubuntu server.
Install PHP 7.2 on Ubuntu 18.04
Update UbuntuAgain, before doing anything, you should update your server:
apt-get update && apt-get upgrade
Install PHP 7.2Next, on Ubuntu 18.04 To install PHP 7.2, just run the following command:
apt-get install php
This command will install PHP 7.2 along with some other dependencies.
To verify that PHP is installed, run the following command:
php -v
You should get a response similar to the following:
PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
That’s it. PHP 7.2 is installed on Ubuntu 18.04 server.
Install PHP 7.2 ModulesThese are the most common PHP 7.2 modules that are often used by php applications. You may need more or less, so check the requirements for the software you plan to use:
apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
To check all available PHP modules in Ubuntu, run:
apt-cache search --names-only ^php
Install PHP 7.3 on Ubuntu 18.04 or 16.04 PHP 7.3是一个稳定的版本,可以在服务器上安全使用。 更新Ubuntu 首先,更新你的Ubuntu服务器: 添加PHP存储库 要安装PHP 7.3,您需要使用第三方存储库。我们将使用以前使用的OndřejSurý的存储库。 首先,请确保已安装以下软件包,以便可以添加存储库: 接下来,从Ondřej添加PHP存储库: 最后,更新安装包 安装PHP 7.3 添加存储库后,可以使用以下命令安装PHP 7.3: 此命令将安装其他软件包: libapache2-mod-php7.3 libaprutil1-dbd-sqlite3 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline 等等其他…… 安装PHP 7.3模块 就这样。现在,你可以在Ubuntu服务器上开始使用PHP。 如何更改你使用的PHP版本 如果你在Ubuntu服务器上安装了多个PHP版本,则可以更改默认版本。 要将PHP 7.2设置为默认值,请运行: 要将PHP 7.3设置为默认值,请运行: 要将PHP 7.4设置为默认值,请运行: The above is the detailed content of How to install php7.2, php7.3, php7.4 in Ubuntu? (Detailed explanation of method). For more information, please follow other related articles on the PHP Chinese website!apt-get update && apt-get upgrade
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.3
就是这样。要检查服务器上是否安装了PHP 7.3,请运行以下命令:php -v
根据你的应用程序,你可能需要其他软件包和模块。可以使用以下命令安装最常用的模块:apt-get install php-pear php7.3-curl php7.3-dev php7.3-gd php7.3-mbstring php7.3-zip php7.3-mysql php7.3-xml
update-alternatives --set php /usr/bin/php7.2
update-alternatives --set php /usr/bin/php7.3
update-alternatives --set php /usr/bin/php7.4

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



It is a very common problem these days that Ubuntu does not allow its users to open the terminal. If you receive a similar issue and don’t know what to do next, learn about five fixes on how to resolve this “Ubuntu cannot open terminal” issue on your Linux device. Without further ado, let’s dive into what causes it and the solutions available to it. Why can't Ubuntu open the terminal on it? This mainly happens when you install some defective software or modify the terminal configuration. In addition to this, new applications or games that interact with locales and corrupt them can cause similar problems. Some users reported a fix for this issue when searching for Terminal in Ubuntu's activity menu. This shows that

In the Ubuntu system, we often encounter folders with a lock shape on the top. This file often cannot be edited or moved. This is because there is no permission to edit the file, so we need to modify its permissions. How to remove the lock in the lower right corner? Let’s take a look at the detailed tutorial below. 1. Right-click on the locked folder--Properties. 2. Select the permissions option in the window. 3. Select everything inside to create and delete files. 4. Then select Change the permissions of the included files at the bottom, which are also set to create and delete files. Finally, remember to click Change in the upper right corner. 5. If the above lock is still not removed, or the options are grayed out and cannot be operated, you can right-click inside - open the terminal. 6. make

There are many software icons listed in the Ubuntu system start menu. There are many uncommon icons. If you want to delete them, how should you delete them? Let’s take a look at the detailed tutorial below. 1. First enter the ubuntu desktop and click on the start menu under the left panel. 2. You can find a text editor icon inside, we need to delete it. 3. Now we return to the desktop and right-click the mouse to open the terminal. 4. Use the command to open the application list directory. sudonautilus/usr/share/applicationssudonautilus~/.local/share/applications5. Find the corresponding text editor icon inside. 6. Then go straight

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

Ubuntu24.04LTS, codenamed "NobleNumbat" will be released soon! If you are using a non-LTS version such as Ubuntu 23.10, sooner or later you will need to consider upgrading. For those using Ubuntu20.04LTS or Ubuntu22.04LTS, it is worth thinking about whether to upgrade. Canonical has announced that Ubuntu 24.04LTS will provide update support for up to 12 years, broken down as follows: As an LTS version, it will have 5 years of regular maintenance and security updates. If you subscribe to Ubuntu Pro, you can enjoy an additional 5 years of support. Currently, this additional support period has been extended to 7 years, which means you will get up to 12

OBS is open source software developed by volunteer contributors around the world in their free time. A video live recording software, mainly used for video recording and live streaming. Please note that when installing Ubuntu/Mint, OBSStudio cannot fully work on ChromeOS, and functions such as screen and window capture cannot be used. It is recommended to use xserver-xorg1.18.4 or newer version to avoid potential performance issues with certain features in OBS, such as full-screen projectors. FFmpeg is required. If you don't have FFmpeg installed (if you're not sure, you probably don't), you can get it with: sudoaptinstallffmpeg I already have it installed here

snap is a software packaging and deployment system developed by Canonical for operating systems that use the Linux kernel and systemdinit system. These packages, known as snaps, and the tool that uses them, snapd, are available across a range of Linux distributions and allow upstream software developers to publish their applications directly to users. With snap, users can easily install Linux applications. By default, snapd will check for updates four times a day and automatically update snap applications to the latest version. While there are many ways to control when and how often updates are installed, users cannot completely turn off automatic updates for security reasons. Although the original intention of snap is good, many people use it to

Starting from Ubuntu 11.04, a new feature has been added called the global menu, which is a common menu bar shared by all applications (shown above). Most of us have been used to each application window having its own menu bar. A global menu is available on the top panel of the Unity desktop, regardless of where the application window is. If the application window in the lower right corner of your screen is resized to small, the application's menu bar remains on the top panel. This can be confusing and uncomfortable if you're not used to it. This experience mainly refers to "This is How Linux Should Be Learned". If you don't like the new global menu and want to move the menu bar back to each application window, we will show you how to disable the global menu. 1. Press Ctrl+Al
