In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How to install php7.2, php7.3, php7.4 in Ubuntu? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
Applies to any Ubuntu version and other Ubuntu-based versions. Ubuntu 14.04 Ubuntu 16.04 million Ubuntu 18.04 or even Ubuntu 19.10.
Before we begin
PHP has different versions and distributions that can be used. 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 setting 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.04or 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 a PHP repository
To install PHP 7.4, a third-party repository is required. We will use the repository of the Ond ejSur arrow that we used again before.
First, make sure that the following packages are installed so that you can add repositories:
Apt-get install software-properties-common
Next, add the PHP repository from the Ond repository 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 installs other software packages:
Libapache2-mod-php7.4
Libaprutil1-dbd-sqlite3
Php7.4-cli
Php7.4-common
Php7.4-json
Php7.4-opcache
Php7.4-readline
Wait a minute...
okay. To check if PHP 7.4 is installed on the server, run the following command:
Php-v
Install the PHP 7.4 module
Depending on your application, you may need other packages and modules. You can install the most commonly used modules 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
In this way, you can start using PHP on the Ubuntu server.
Install PHP 7.2 on Ubuntu 16.04
PHP 7.2 is a stable version of PHP with many new features, improvements and bug fixes. If you want a better, faster website / application, you should definitely use it.
Update Ubuntu
Of course, as always, update Ubuntu first:
Apt-get update & & apt-get upgrade
Add a PHP repository
You can use a third-party repository to install the latest version of PHP. We will use the repository of the Ond ejSur arrow.
First, make sure that the following packages are installed so that you can add repositories:
Apt-get install software-properties-common
Next, add the PHP repository from the Ond repository 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 installs other software 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
okay. To check if PHP 7.2 is installed on the server, run the following command:
Php-v
Install the PHP 7.2 module
Depending on your application, you may need other packages and modules. You can install the most commonly used modules 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
In this way, you can start using PHP on the Ubuntu server.
Install PHP 7.2 on Ubuntu 18.04
Update Ubuntu
Similarly, before you do anything, you should update the server:
Apt-get update & & apt-get upgrade
Install PHP 7.2
Next, to install PHP 7.2 on Ubuntu 18.04, simply run the following command:
Apt-get install php
This command installs PHP 7.2and 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)
okay. PHP 7.2 has been installed on the Ubuntu 18.04 server.
Install the PHP 7.2 module
These are the most common PHP 7.2 modules commonly used by php applications. You may need it more or less, so check the requirements of 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.04or 16.04
PHP 7.3 is a stable version that can be safely used on the server.
Update Ubuntu
First, update your Ubuntu server:
Apt-get update & & apt-get upgrade
Add a PHP repository
To install PHP 7.3, you need to use a third-party repository. We will use the previously used repository of the Ond ejSur arrow.
First, make sure that the following packages are installed so that you can add repositories:
Apt-get install software-properties-common
Next, add the PHP repository from the Ond repository ej:
Add-apt-repository ppa:ondrej/php
Finally, update the installation package
Apt-get update
Install PHP 7.3
After adding the repository, you can install PHP 7.3 using the following command:
Apt-get install php7.3
This command installs other software packages:
Libapache2-mod-php7.3
Libaprutil1-dbd-sqlite3
Php7.3-cli
Php7.3-common
Php7.3-json
Php7.3-opcache
Php7.3-readline
Wait, other...
okay. To check if PHP 7.3 is installed on the server, run the following command:
Php-v
Install the PHP 7.3module
Depending on your application, you may need other packages and modules. You can install the most commonly used modules using the following command:
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
That's all. Now you can start using PHP on the Ubuntu server.
How to change the version of PHP you use
If you have multiple PHP versions installed on the Ubuntu server, you can change the default version.
To set PHP 7.2 as the default, run:
Update-alternatives-set php / usr/bin/php7.2
To set PHP 7.3 as the default, run:
Update-alternatives-set php / usr/bin/php7.3
To set PHP 7.4 as the default, run:
Update-alternatives-does set php / usr/bin/php7.4 help you after reading the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.