K
K
kkoshakk2016-07-20 19:43:03
PHP
kkoshakk, 2016-07-20 19:43:03

How to properly install PHP on Ubuntu 16.04?

Which command is correct:
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-mcrypt php7.0-mysql

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nazar Mokrinsky, 2016-07-20
@kkoshakk

The first command is more general, the second is more specific. I prefer the first one.
The difference is that the first command will work in different versions of Ubuntu, and depending on what is available. On 14.04 this will install the fifth version, on 16.04 the seventh.
I always install generic versions whenever possible, as it also makes it easier to update packages.
For example, you can install mariadb-server, or mariadb-server-10.1. The difference is that over time you upgrade the distribution, the mariadb-server-10.1 package will disappear, mariadb-server-11 will appear instead. As a result, you will be left with an outdated non-upgradable version of mariadb. In the case of mariadb-server, during the upgrade, the mariadb-server-10.1 dependency will be suggested for removal and mariadb-server-11 will be suggested for installation. This makes it much easier to keep the system up to date.
PS Forget about mcrypt, the library is hopelessly outdated, has not been updated for many years and is strongly not recommended for use.

S
Sanes, 2016-07-20
@Sanes

See the source for an example . Links below.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question