Attempting to install php-xmlrpc on an image with php7.3 installed on it.
As you can see, I tried apt-get update but it does not help. I have tried using php7.3-xmlrpc also.
Dockerfile line:
RUN apt-get update && apt-get install php-xmlrpc -y
Docker build output:
Step 5/8 : RUN apt-get update && apt-get install php-xmlrpc -y
---> Running in 163542fabd8a
Get:1 http://security-cdn.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Get:2 http://security-cdn.debian.org/debian-security buster/updates InRelease [39.1 kB]
Ign:3 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:4 http://security-cdn.debian.org/debian-security stretch/updates/main amd64 Packages [500 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Hit:6 http://cdn-fastly.deb.debian.org/debian buster InRelease
Get:7 http://security-cdn.debian.org/debian-security buster/updates/main amd64 Packages [112 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:9 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages.diff/Index [12.5 kB]
Get:10 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages 2019-10-27-2015.53.pdiff [398 B]
Get:12 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages 2019-11-06-2017.59.pdiff [903 B]
Get:12 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages 2019-11-06-2017.59.pdiff [903 B]
Hit:11 http://cdn-fastly.deb.debian.org/debian stretch Release
Fetched 900 kB in 1s (634 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package php-xmlrpc is a virtual package provided by:
php7.3-xmlrpc 7.3.11-1~deb10u1 [Not candidate version]
php7.3-xmlrpc 7.3.4-2 [Not candidate version]
php7.0-xmlrpc 7.0.33-0+deb9u6 [Not candidate version]
php7.0-xmlrpc 7.0.33-0+deb9u3 [Not candidate version]
E: Package 'php-xmlrpc' has no installation candidate
Docker file:
FROM php:7.3-apache
RUN apt-get update -y && apt-get upgrade -y;
RUN apt-get install -y libxml2-dev
RUN docker-php-ext-install -j$(nproc) xmlrpc
that works.
If you build it this way:
docker build --tag stackoverflow .
then you can check installed extension by runnig command:
docker run -it --entrypoint="" --rm stackoverflow /bin/bash
and type into console
php -m
that gives the output:
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
zlib
with:
xmlrpc
I'm following this tutorial: Laravel 5.6 in Docker with PHP 7.2, NGINX 1.10 and MySQL 5.7
Which is basically an update of this: Laravel + Docker Part 1 — setup for Development
But when I ran
docker-compose up
I got this error
E: Unable to locate package mysql-client —-no-install-recommends
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y mysql-client —-no-install-recommends && docker-php-ext-install pdo_mysql' returned a non-zero code: 100
A full output
Creating network "pulzu_default" with the default driver
Building app
Step 1/2 : FROM php:7.2.2-fpm
---> 60245f64ed12
Step 2/2 : RUN apt-get update && apt-get install -y mysql-client —-no-install-recommends && docker-php-ext-install pdo_mysql
---> Running in cefd70564b31
Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]
Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:3 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:5 http://security.debian.org stretch/updates/main amd64 Packages [468 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian stretch Release [118 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian stretch Release.gpg [2434 B]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
Fetched 10.3 MB in 2s (4142 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package mysql-client —-no-install-recommends
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y mysql-client —-no-install-recommends && docker-php-ext-install pdo_mysql' returned a non-zero code: 100
Does anyone have any idea how to fix it?
The image is missing dependencies to be able to install mysql-client, this is caused by the --no-install-recommends flag. By default, Ubuntu installs recommended but not suggested packages. With --no-install-recommends, only the main dependencies (packages in the Depends field) are installed.
Change the Dockerfile or according to the article app.dockerfile to:
FROM php:7.2.2-fpm
RUN apt-get update && apt-get install -y mysql-client \
&& docker-php-ext-install pdo_mysql
And you should be able to build the image, therefore the docker-compose up command would work.
I was told to install mysqlnd by running sudo apt-get install php5-mysqlnd. However, I seem to have received an error. Any idea what's going on and how I can fix it? I'm running Ubuntu Server.
zerg#server:~$ sudo apt-get install php5-mysqlnd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
php5-mysql
The following NEW packages will be installed: php5-mysqlnd
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 134 kB of archives.
After this operation, 247 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/universe php5- mysqlnd amd64 5.5.9+dfsg-1ubuntu4.14
404 Not Found [IP: 2001:67c:1560:8001::11 80]
Err http://security.ubuntu.com/ubuntu/ trusty-security/universe php5-mysqlnd amd64 5.5.9+dfsg-1ubuntu4.14
404 Not Found [IP: 2001:67c:1560:8001::11 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/p/php5/php5-mysqlnd_5.5.9+dfsg-1ubuntu4.14_amd64.deb 404 Not Found [IP: 2001:67c:1560:8001::11 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
zerg#server:~$ sudo apt-get install php5-mysqlnd --fix-missing
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED: php5-mysql
The following NEW packages will be installed:
php5-mysqlnd
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 134 kB of archives.
After this operation, 247 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err http://archive.ubuntu.com/ubuntu/ trusty-updates/universe php5- mysqlnd amd64 5.5.9+dfsg-1ubuntu4.14
404 Not Found [IP: 2001:67c:1560:8001::11 80]
Err http://security.ubuntu.com/ubuntu/ trusty-security/universe php5-mysqlnd amd64 5.5.9+dfsg-1ubuntu4.14
404 Not Found [IP: 2001:67c:1560:8001::11 80]
(Reading database ... 28529 files and directories currently installed.)
Removing php5-mysql (5.5.9+dfsg-1ubuntu4.14) ...
php5_invoke prerm: Disable module mysql for fpm SAPI
php5_invoke prerm: Disable module mysql for cli SAPI
php5_invoke prerm: Disable module mysqli for fpm SAPI
php5_invoke prerm: Disable module mysqli for cli SAPI
php5_invoke prerm: Disable module pdo_mysql for fpm SAPI
php5_invoke prerm: Disable module pdo_mysql for cli SAPI
Processing triggers for php5-fpm (5.5.9+dfsg-1ubuntu4.14) ...
php5-fpm stop/waiting
php5-fpm start/running, process 17187
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/p/php5/php5-mysqlnd_5.5.9+dfsg-1ubuntu4.14_amd64.deb 404 Not Found [IP: 2001:67c:1560:8001::11 80]
I would like to have php 5.4 on my ubuntu server, even if it's no longer supported.
Then I tried the ppa:ondrej/php5-oldstable repository like this :
sudo add-apt-repository ppa:ondrej/php5-oldstable
But it adds the repository below
[ubuntu#nixmind~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
# deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty
main
and was still giving php5.5.9 with apt-cache policy.
[ubuntu#nixmind ~]$ apt-cache policy php5
php5:
Installed: 5.4.45-3+donate.sury.org~precise+3
Candidate: 5.5.9+dfsg-1ubuntu4.17
Version table:
5.5.9+dfsg-1ubuntu4.17 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
I then add the precise repos manually like this :
[ubuntu#nixmind ~]$ cat /etc/apt/sources.list.d/ondrej-php5-oldstable-trusty.list
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main
deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main
# deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu trusty main
and had this :
[ubuntu#nixmind ~]$ apt-cache policy php5
php5:
Installed: (none)
Candidate: 5.5.9+dfsg-1ubuntu4.17
Version table:
5.5.9+dfsg-1ubuntu4.17 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
5.4.45-3+donate.sury.org~precise+3 0
500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
I then installed php5.4 like this :
sudo apt-get install php5=5.4.45-3+donate.sury.org~precise+3
But php is saying that the version is 5.5.9 while apt-cache policy says it's 5.4
[ubuntu#nixmind ~]$ apt-cache policy php5
php5:
Installed: 5.4.45-3+donate.sury.org~precise+3
Candidate: 5.5.9+dfsg-1ubuntu4.17
Version table:
5.5.9+dfsg-1ubuntu4.17 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
5.5.9+dfsg-1ubuntu4 0
500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
*** 5.4.45-3+donate.sury.org~precise+3 0
500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
and
[ubuntu#nixmind ~]$ php -v
PHP 5.5.9-1ubuntu4.17 (cli) (built: May 19 2016 19:05:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
Then my questions are :
Why is there a difference between php -v and apt-cache policy
outputs?
Is it just not possible to install php5.4 on ubuntu trusty actually?
Is a good way to have php5?4 running on ubuntu trusty without this
ambiguity?
Regards.
Try Linuxbrew. It can install two or more PHP versions side by side.
It works for me on Linux Mint 17.3 (which is based on Ubuntu 14.04) with PHP 5.4, 5.5, 5.6, 7.0 and 7.1.
PHP 5.3 doesn't compile though :-(
Since php7 has been released, I wanted to try it out on my current machine.
I have tried building it from source using this gist yet that fails for me (and I have posted the error message in the thread).
Yet the question is not necessarily solving the compiling issue, but more basic:
How can I install php7?
I am on Ubuntu14.04, yet I would like for the answer to be operating-system-agnostic.
For install php7 in ubuntu 14.04 system please follow mentioned below steps:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
for use mysql
sudo apt-get install php7.0-mysql
sudo service apache2 restart
If you want to remove php5 then after installation of php7 follow the steps mentioned below:
sudo apt-get update
sudo apt-get purge php5-common -y
sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y
sudo apt-get --purge autoremove -y
I shared at https://jaimemontoya.com/learning-php-7/#20190807165248 the way I installed PHP Version 7.0.33-8 on Ubuntu 18.04.1. I also posted a screenshot of what my <?php phpinfo();?> returned after the successful installation. See below the steps I followed:
root#jaimemontoya:/# pwd
/
root#jaimemontoya:/# apt-add-repository ppa:ondrej/php
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
or ppa:ondrej/nginx
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or Ctrl-c to cancel adding it.
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease [20.8 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [697 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [7,024 B]
Get:9 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [983 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [299 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [11.9 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [577 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [189 kB]
Get:14 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages [45.2 kB]
Get:15 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main Translation-en [22.1 kB]
Fetched 3,029 kB in 2s (1,515 kB/s)
Reading package lists... Done
root#jaimemontoya:/# apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease
Hit:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Reading package lists... Done
root#jaimemontoya:/# apt-get install php7.0 php7.0-fpm php7.0-mysql -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpcre3 php-common php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
php-common php7.0 php7.0-cli php7.0-common php7.0-fpm php7.0-json php7.0-mysql php7.0-opcache php7.0-readline
The following packages will be upgraded:
libpcre3
1 upgraded, 9 newly installed, 0 to remove and 40 not upgraded.
Need to get 4,047 kB of archives.
After this operation, 14.6 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libpcre3 amd64 2:8.43-1+ubuntu18.04.1+deb.sury.org+1 [237 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php-common all 2:69+ubuntu18.04.1+deb.sury.org+2+php7.3 [15.1 kB]
Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-common amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [897 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-json amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [17.2 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-opcache amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [79.1 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-readline amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [12.6 kB]
Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-cli amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [1,300 kB]
Get:8 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-fpm amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [1,307 kB]
Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0 all 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [56.3 kB]
Get:10 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.0-mysql amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [125 kB]
Fetched 4,047 kB in 4s (916 kB/s)
(Reading database ... 169946 files and directories currently installed.)
Preparing to unpack .../libpcre3_2%3a8.43-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre3:amd64 (2:8.43-1+ubuntu18.04.1+deb.sury.org+1) over (2:8.39-9) ...
Setting up libpcre3:amd64 (2:8.43-1+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php-common.
(Reading database ... 169946 files and directories currently installed.)
Preparing to unpack .../0-php-common_2%3a69+ubuntu18.04.1+deb.sury.org+2+php7.3_all.deb ...
Unpacking php-common (2:69+ubuntu18.04.1+deb.sury.org+2+php7.3) ...
Selecting previously unselected package php7.0-common.
Preparing to unpack .../1-php7.0-common_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-common (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0-json.
Preparing to unpack .../2-php7.0-json_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-json (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0-opcache.
Preparing to unpack .../3-php7.0-opcache_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-opcache (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0-readline.
Preparing to unpack .../4-php7.0-readline_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-readline (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0-cli.
Preparing to unpack .../5-php7.0-cli_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-cli (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0-fpm.
Preparing to unpack .../6-php7.0-fpm_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-fpm (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0.
Preparing to unpack .../7-php7.0_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_all.deb ...
Unpacking php7.0 (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.0-mysql.
Preparing to unpack .../8-php7.0-mysql_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.0-mysql (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up php-common (2:69+ubuntu18.04.1+deb.sury.org+2+php7.3) ...
Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpsessionclean.timer.
Processing triggers for systemd (237-3ubuntu10.22) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up php7.0-common (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/mods-available/calendar.ini with new version
Creating config file /etc/php/7.0/mods-available/ctype.ini with new version
Creating config file /etc/php/7.0/mods-available/exif.ini with new version
Creating config file /etc/php/7.0/mods-available/fileinfo.ini with new version
Creating config file /etc/php/7.0/mods-available/ftp.ini with new version
Creating config file /etc/php/7.0/mods-available/gettext.ini with new version
Creating config file /etc/php/7.0/mods-available/iconv.ini with new version
Creating config file /etc/php/7.0/mods-available/pdo.ini with new version
Creating config file /etc/php/7.0/mods-available/phar.ini with new version
Creating config file /etc/php/7.0/mods-available/posix.ini with new version
Creating config file /etc/php/7.0/mods-available/shmop.ini with new version
Creating config file /etc/php/7.0/mods-available/sockets.ini with new version
Creating config file /etc/php/7.0/mods-available/sysvmsg.ini with new version
Creating config file /etc/php/7.0/mods-available/sysvsem.ini with new version
Creating config file /etc/php/7.0/mods-available/sysvshm.ini with new version
Creating config file /etc/php/7.0/mods-available/tokenizer.ini with new version
Setting up php7.0-mysql (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/mods-available/mysqlnd.ini with new version
Creating config file /etc/php/7.0/mods-available/mysqli.ini with new version
Creating config file /etc/php/7.0/mods-available/pdo_mysql.ini with new version
Setting up php7.0-readline (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/mods-available/readline.ini with new version
Setting up php7.0-opcache (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/mods-available/opcache.ini with new version
Setting up php7.0-json (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/mods-available/json.ini with new version
Setting up php7.0-cli (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
update-alternatives: using /usr/bin/php7.0 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.0 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.0 to provide /usr/bin/phar.phar (phar.phar) in auto mode
Creating config file /etc/php/7.0/cli/php.ini with new version
Setting up php7.0-fpm (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/fpm/php.ini with new version
NOTICE: Not enabling PHP 7.0 FPM by default.
NOTICE: To enable PHP 7.0 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.0-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink /etc/systemd/system/multi-user.target.wants/php7.0-fpm.service → /lib/systemd/system/php7.0-fpm.service.
Setting up php7.0 (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.22) ...
root#jaimemontoya:/# apt-get --purge autoremove -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
root#jaimemontoya:/# service php7.0-fpm start
root#jaimemontoya:/# php -v
PHP 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:34:35) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-8+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
root#jaimemontoya:/# apt purge libapache2-mod-php7.0 libapache2-mod-php
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'libapache2-mod-php' is not installed, so not removed
Package 'libapache2-mod-php7.0' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
root#jaimemontoya:/# apt install libapache2-mod-php7.0 libapache2-mod-php
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libapache2-mod-php7.3 libpcre2-8-0 libsodium23 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
libapache2-mod-php libapache2-mod-php7.0 libapache2-mod-php7.3 libpcre2-8-0 libsodium23 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline
0 upgraded, 10 newly installed, 0 to remove and 40 not upgraded.
Need to get 5,439 kB of archives.
After this operation, 22.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.3-common amd64 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 [938 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.3-json amd64 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 [18.4 kB]
Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.3-opcache amd64 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 [182 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.3-readline amd64 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 [12.0 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libpcre2-8-0 amd64 10.33-1+ubuntu18.04.1+deb.sury.org+1 [191 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libsodium23 amd64 1.0.17-0.1+ubuntu18.04.1+deb.sury.org+1 [147 kB]
Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php7.3-cli amd64 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 [1,378 kB]
Get:8 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libapache2-mod-php7.3 amd64 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 [1,324 kB]
Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libapache2-mod-php all 2:7.3+69+ubuntu18.04.1+deb.sury.org+2+php7.3 [6,244 B]
Get:10 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libapache2-mod-php7.0 amd64 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 [1,242 kB]
Fetched 5,439 kB in 5s (1,094 kB/s)
Selecting previously unselected package php7.3-common.
(Reading database ... 170110 files and directories currently installed.)
Preparing to unpack .../0-php7.3-common_7.3.7-2+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-common (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.3-json.
Preparing to unpack .../1-php7.3-json_7.3.7-2+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-json (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.3-opcache.
Preparing to unpack .../2-php7.3-opcache_7.3.7-2+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-opcache (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.3-readline.
Preparing to unpack .../3-php7.3-readline_7.3.7-2+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-readline (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package libpcre2-8-0:amd64.
Preparing to unpack .../4-libpcre2-8-0_10.33-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre2-8-0:amd64 (10.33-1+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package libsodium23:amd64.
Preparing to unpack .../5-libsodium23_1.0.17-0.1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libsodium23:amd64 (1.0.17-0.1+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php7.3-cli.
Preparing to unpack .../6-php7.3-cli_7.3.7-2+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.3-cli (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package libapache2-mod-php7.3.
Preparing to unpack .../7-libapache2-mod-php7.3_7.3.7-2+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libapache2-mod-php7.3 (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package libapache2-mod-php.
Preparing to unpack .../8-libapache2-mod-php_2%3a7.3+69+ubuntu18.04.1+deb.sury.org+2+php7.3_all.deb ...
Unpacking libapache2-mod-php (2:7.3+69+ubuntu18.04.1+deb.sury.org+2+php7.3) ...
Selecting previously unselected package libapache2-mod-php7.0.
Preparing to unpack .../9-libapache2-mod-php7.0_7.0.33-8+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libapache2-mod-php7.0 (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php7.3-common (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.3/mods-available/calendar.ini with new version
Creating config file /etc/php/7.3/mods-available/ctype.ini with new version
Creating config file /etc/php/7.3/mods-available/exif.ini with new version
Creating config file /etc/php/7.3/mods-available/fileinfo.ini with new version
Creating config file /etc/php/7.3/mods-available/ftp.ini with new version
Creating config file /etc/php/7.3/mods-available/gettext.ini with new version
Creating config file /etc/php/7.3/mods-available/iconv.ini with new version
Creating config file /etc/php/7.3/mods-available/pdo.ini with new version
Creating config file /etc/php/7.3/mods-available/phar.ini with new version
Creating config file /etc/php/7.3/mods-available/posix.ini with new version
Creating config file /etc/php/7.3/mods-available/shmop.ini with new version
Creating config file /etc/php/7.3/mods-available/sockets.ini with new version
Creating config file /etc/php/7.3/mods-available/sysvmsg.ini with new version
Creating config file /etc/php/7.3/mods-available/sysvsem.ini with new version
Creating config file /etc/php/7.3/mods-available/sysvshm.ini with new version
Creating config file /etc/php/7.3/mods-available/tokenizer.ini with new version
Setting up libapache2-mod-php7.0 (7.0.33-8+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.0/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.0
Setting up php7.3-opcache (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.3/mods-available/opcache.ini with new version
Setting up libsodium23:amd64 (1.0.17-0.1+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up php7.3-readline (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.3/mods-available/readline.ini with new version
Setting up libpcre2-8-0:amd64 (10.33-1+ubuntu18.04.1+deb.sury.org+1) ...
Setting up php7.3-json (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.3/mods-available/json.ini with new version
Setting up php7.3-cli (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
update-alternatives: using /usr/bin/php7.3 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.3 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.3 to provide /usr/bin/phar.phar (phar.phar) in auto mode
Creating config file /etc/php/7.3/cli/php.ini with new version
Setting up libapache2-mod-php7.3 (7.3.7-2+ubuntu18.04.1+deb.sury.org+1) ...
Creating config file /etc/php/7.3/apache2/php.ini with new version
libapache2-mod-php7.3: php7.0 module already enabled, not enabling PHP 7.3
Setting up libapache2-mod-php (2:7.3+69+ubuntu18.04.1+deb.sury.org+2+php7.3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root#jaimemontoya:/#
UPDATE 1:
As you requested it k0pernikus, literally how it was published in Chapter 1 of Learning PHP 7, by Antonio Lopez, published by Packt Publishing:
Installing PHP
The only thing to consider in this section is to remove any previous
PHP versions on your system. To do so, you can run the following
command:
$ sudo apt-get -y purge php.*
The next step is to add the necessary repositories in order to fetch
the correct PHP version. The commands to add and update them are:
$ sudo apt-get install python-software-properties
$ sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php -y
$ sudo apt-get update
Finally, we need to install PHP 7 together with the driver for MySQL.
For this, just execute the following three commands:
$ sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y
$ sudo apt-get --purge autoremove -y
$ sudo apt-get --purge autoremove -y
$ sudo service php7.0-fpm start