Windows 10: Docker build fails on apt-get upgrade with 403 authenticationrequired - php

I am trying to build a docker image for a php 5.6 application on my work machine. The initial steps on Dockerfile are as below:
FROM php:5.6-apache
RUN set -x \
&& apt-get update \
&& apt-get upgrade -y
When I run docker build I get the following output along with an error after the apt-get upgrade command:
#5 0.365 + apt-get update
#5 0.965 Get:1 http://security.debian.org/debian-security stretch/updates InRelease [59.1 kB]
#5 0.977 Ign:2 http://deb.debian.org/debian stretch InRelease
#5 1.223 Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
#5 1.318 Get:4 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [782 kB]
#5 1.478 Get:5 http://deb.debian.org/debian stretch Release [118 kB]
#5 1.784 Get:6 http://deb.debian.org/debian stretch Release.gpg [3177 B]
#5 1.999 Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [7080 kB]
#5 5.073 Fetched 8135 kB in 4s (1742 kB/s)
#5 5.073 Reading package lists...
#5 5.686 + apt-get upgrade -y
#5 5.701 Reading package lists...
#5 6.318 Building dependency tree...
#5 6.433 Reading state information...
#5 6.444 Calculating upgrade...
#5 6.733 The following packages will be upgraded:
#5 6.733 apache2 apache2-bin apache2-data apache2-utils apt base-files
#5 6.733 ca-certificates curl debian-archive-keyring dpkg dpkg-dev e2fslibs e2fsprogs
#5 6.733 file gpgv gzip libapr1 libapt-pkg5.0 libbsd0 libc-bin libc-dev-bin libc6
#5 6.733 libc6-dev libcomerr2 libcurl3 libdpkg-perl libexpat1 libgcrypt20
#5 6.733 libglib2.0-0 libgmp10 libgnutls30 libgssapi-krb5-2 libhogweed4 libicu57
#5 6.733 libidn11 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common
#5 6.733 liblz4-1 liblzma5 libmagic-mgc libmagic1 libnettle6 libnghttp2-14
#5 6.733 libp11-kit0 libperl5.24 libsasl2-2 libsasl2-modules-db libsqlite3-0 libss2
#5 6.733 libssh2-1 libssl1.0.2 libssl1.1 libsystemd0 libudev1 libxml2 linux-libc-dev
#5 6.733 login multiarch-support openssl passwd patch perl perl-base
#5 6.733 perl-modules-5.24 tar tzdata xz-utils zlib1g
#5 7.050 71 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#5 7.050 Need to get 51.0 MB of archives.
#5 7.050 After this operation, 505 kB of additional disk space will be used.
#5 7.050 Get:1 http://security.debian.org/debian-security stretch/updates/main amd64 tar amd64 1.29b-1.1+deb9u1 [760 kB]
#5 7.062 Get:2 http://deb.debian.org/debian stretch/main amd64 base-files amd64 9.9+deb9u13 [67.6 kB]
#5 7.315 Get:3 http://deb.debian.org/debian stretch/main amd64 libc6-dev amd64 2.24-11+deb9u4 [2364 kB]
#5 8.159 Err:4 http://deb.debian.org/debian stretch/main amd64 libc-dev-bin amd64 2.24-11+deb9u4
#5 8.159 403 authenticationrequired
...
...
#5 9.424 Failed to fetch http://deb.debian.org/debian/pool/main/g/glibc/libc6_2.24-11+deb9u4_amd64.deb 403 authenticationrequired
#5 9.424 E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/e/e2fsprogs/e2fslibs_1.43.4-2+deb9u2_amd64.deb 403 authenticationrequired [IP: 151.101.194.132 80]
#5 9.424 E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/e/e2fsprogs/e2fsprogs_1.43.4-2+deb9u2_amd64.deb 403 authenticationrequired [IP: 151.101.194.132 80]
...
...
I know there is a missing config for my docker setup but not sure what it is. I tried installing Docker with wsl, uninstalled it and installed again with Hyper V , but the same issue. Any helpful pointers?

The workaround for this is to install docker CE on a WSL instance (I used ubuntu) on windows. Shutdown docker desktop on host windows machine. Then build the image on the WSL and push it to your docker registry. This way the image can be used anywhere.
Not sure why but docker desktop is not so useful in this case.

Related

laravel sail always error when doing "sail up"

been like 3 hours trying laravel sail and it always error "#0 615.4 /bin/sh: 1: npm: not found"
[+] Building 624.0s (9/16)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.90kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:22.04 8.4s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 99B 0.0s
=> [ 1/11] FROM docker.io/library/ubuntu:22.04#sha256:34fea4f31bf187bc915536831fd0afc9d214755b 0.0s
=> CACHED [ 2/11] WORKDIR /var/www/html 0.0s
=> CACHED [ 3/11] RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezo 0.0s
=> ERROR [ 4/11] RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificate 615.5s
------
> [ 4/11] RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && echo "keyserver hkp://keyserver.ubuntu.com:80" >> ~/.gnupg/dirmngr.conf && gpg --recv-key 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c && gpg --export 0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c > /usr/share/keyrings/ppa_ondrej_php.gpg && echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.1-cli php8.1-dev php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-curl php8.1-imap php8.1-mysql php8.1-mbstring php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap php8.1-intl php8.1-readline php8.1-ldap php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole php8.1-memcached php8.1-pcov php8.1-xdebug && php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sLS https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs && npm install -g npm && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null && echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null && echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client-14 && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*:
#0 0.964 Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
#0 1.118 Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
#0 2.334 Get:3 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [128 kB]
#0 2.737 Get:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
#0 3.024 Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [305 kB]
#0 3.399 Get:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
#0 4.058 Get:7 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
#0 4.183 Get:8 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [4644 B]
#0 4.230 Get:9 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [276 kB]
#0 75.08 Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
#0 82.16 Get:11 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
#0 83.28 Get:12 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
#0 83.93 Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [319 kB]
#0 85.68 Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [7791 B]
#0 85.68 Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [604 kB]
#0 87.97 Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [252 kB]
#0 89.35 Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [5814 B]
#0 89.37 Fetched 22.2 MB in 1min 29s (249 kB/s)
#0 89.37 Reading package lists...
#0 89.90 Reading package lists...
#0 90.39 Building dependency tree...
#0 90.57 Reading state information...
#0 90.70 The following additional packages will be installed:
#0 90.70 dirmngr fontconfig-config fonts-dejavu-core git-man gnupg-l10n gnupg-utils
#0 90.70 gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm less libassuan0
#0 90.70 libbrotli1 libbsd0 libc-dev-bin libc-devtools libc6-dev libcbor0.8
#0 90.70 libcrypt-dev libcurl3-gnutls libcurl4 libdeflate0 libedit2 liberror-perl
#0 90.70 libexpat1 libfido2-1 libfontconfig1 libfreetype6 libgd3 libgdbm-compat4
#0 90.70 libgdbm6 libjbig0 libjpeg-turbo8 libjpeg8 libksba8 libldap-2.5-0
#0 90.70 libldap-common libmd0 libmpdec3 libnghttp2-14 libnpth0 libnsl-dev libpam-cap
#0 90.70 libperl5.34 libpng-tools libpng16-16 libpsl5 libpython2-stdlib
#0 90.70 libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib
#0 90.70 libpython3.10-minimal libpython3.10-stdlib libreadline8 librtmp1 libsasl2-2
#0 90.70 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssh-4 libtiff5
#0 90.70 libtirpc-dev libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
#0 90.70 libxext6 libxmuu1 libxpm4 linux-libc-dev manpages manpages-dev media-types
#0 90.70 netbase openssh-client openssl patch perl perl-modules-5.34 pinentry-curses
#0 90.70 publicsuffix python2-minimal python2.7 python2.7-minimal python3
#0 90.70 python3-minimal python3-pkg-resources python3.10 python3.10-minimal
#0 90.70 readline-common rpcsvc-proto ucf xauth zlib1g-dev
#0 90.70 Suggested packages:
#0 90.70 dbus-user-session libpam-systemd pinentry-gnome3 tor gettext-base
#0 90.70 git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb
#0 90.70 git-cvs git-mediawiki git-svn parcimonie xloadimage scdaemon glibc-doc
#0 90.70 libgd-tools gdbm-l10n libsasl2-modules-gssapi-mit
#0 90.70 | libsasl2-modules-gssapi-heimdal libsasl2-modules-ldap libsasl2-modules-otp
#0 90.70 libsasl2-modules-sql man-browser keychain libpam-ssh monkeysphere
#0 90.70 ssh-askpass ed diffutils-doc perl-doc libterm-readline-gnu-perl
#0 90.70 | libterm-readline-perl-perl make libtap-harness-archive-perl pinentry-doc
#0 90.70 python2-doc python-tk python2.7-doc binutils binfmt-support python3-doc
#0 90.70 python3-tk python3-venv python3-setuptools python3.10-venv python3.10-doc
#0 90.70 readline-doc sqlite3-doc supervisor-doc
#0 90.82 The following NEW packages will be installed:
#0 90.82 ca-certificates curl dirmngr fontconfig-config fonts-dejavu-core git git-man
#0 90.82 gnupg gnupg-l10n gnupg-utils gosu gpg gpg-agent gpg-wks-client
#0 90.82 gpg-wks-server gpgconf gpgsm less libassuan0 libbrotli1 libbsd0 libc-dev-bin
#0 90.82 libc-devtools libc6-dev libcap2-bin libcbor0.8 libcrypt-dev libcurl3-gnutls
#0 90.82 libcurl4 libdeflate0 libedit2 liberror-perl libexpat1 libfido2-1
#0 90.82 libfontconfig1 libfreetype6 libgd3 libgdbm-compat4 libgdbm6 libjbig0
#0 90.82 libjpeg-turbo8 libjpeg8 libksba8 libldap-2.5-0 libldap-common libmd0
#0 90.82 libmpdec3 libnghttp2-14 libnpth0 libnsl-dev libpam-cap libperl5.34
#0 90.82 libpng-dev libpng-tools libpng16-16 libpsl5 libpython2-stdlib
#0 90.82 libpython2.7-minimal libpython2.7-stdlib libpython3-stdlib
#0 90.82 libpython3.10-minimal libpython3.10-stdlib libreadline8 librtmp1 libsasl2-2
#0 90.82 libsasl2-modules libsasl2-modules-db libsqlite3-0 libssh-4 libtiff5
#0 90.82 libtirpc-dev libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6
#0 90.82 libxext6 libxmuu1 libxpm4 linux-libc-dev manpages manpages-dev media-types
.........
#0 614.6 Preparing to unpack .../0-libuv1_1.43.0-1_amd64.deb ...
#0 614.7 Unpacking libuv1:amd64 (1.43.0-1) ...
#0 614.7 Selecting previously unselected package javascript-common.
#0 614.7 Preparing to unpack .../1-javascript-common_11+nmu1_all.deb ...
#0 614.7 Unpacking javascript-common (11+nmu1) ...
#0 614.7 Selecting previously unselected package libjs-highlight.js.
#0 614.7 Preparing to unpack .../2-libjs-highlight.js_9.18.5+dfsg1-1_all.deb ...
#0 614.8 Unpacking libjs-highlight.js (9.18.5+dfsg1-1) ...
#0 614.8 Selecting previously unselected package libc-ares2:amd64.
#0 614.8 Preparing to unpack .../3-libc-ares2_1.18.1-1build1_amd64.deb ...
#0 614.8 Unpacking libc-ares2:amd64 (1.18.1-1build1) ...
#0 614.9 Selecting previously unselected package libnode72:amd64.
#0 614.9 Preparing to unpack .../4-libnode72_12.22.9~dfsg-1ubuntu3_amd64.deb ...
#0 614.9 Unpacking libnode72:amd64 (12.22.9~dfsg-1ubuntu3) ...
#0 615.0 Selecting previously unselected package nodejs-doc.
#0 615.0 Preparing to unpack .../5-nodejs-doc_12.22.9~dfsg-1ubuntu3_all.deb ...
#0 615.0 Unpacking nodejs-doc (12.22.9~dfsg-1ubuntu3) ...
#0 615.1 Selecting previously unselected package nodejs.
#0 615.1 Preparing to unpack .../6-nodejs_12.22.9~dfsg-1ubuntu3_amd64.deb ...
#0 615.1 Unpacking nodejs (12.22.9~dfsg-1ubuntu3) ...
#0 615.1 Setting up javascript-common (11+nmu1) ...
#0 615.2 Setting up libc-ares2:amd64 (1.18.1-1build1) ...
#0 615.2 Setting up libuv1:amd64 (1.43.0-1) ...
#0 615.2 Setting up libjs-highlight.js (9.18.5+dfsg1-1) ...
#0 615.2 Setting up libnode72:amd64 (12.22.9~dfsg-1ubuntu3) ...
#0 615.2 Setting up nodejs-doc (12.22.9~dfsg-1ubuntu3) ...
#0 615.2 Setting up nodejs (12.22.9~dfsg-1ubuntu3) ...
#0 615.3 update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
#0 615.3 update-alternatives: warning: skip creation of /usr/share/man/man1/js.1.gz because associated file /usr/share/man/man1/nodejs.1.gz (of link group js) doesn't exist
#0 615.3 Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
#0 615.3 Processing triggers for man-db (2.10.2-1) ...
#0 615.4 /bin/sh: 1: npm: not found
anyone ever meet this problem before ? how to fix this ?
i use newer docker version and windows 11 pro.
this is first time i use laravel sail and i followed the docs in laravel website and still get the same result.
it's seems everytime i use WARP my laravel sail always failed to build, not sure if there is a change to the repo/warp itself that's started causing it.
so the best solution is disabling WARP temporary till it fix.

E: Package 'php-xmlrpc' has no installation candidate

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

Docker: E: Unable to locate package mysql-client —-no-install-recommends

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.

Laravel Homestead 'apt-get update' gives some 404

Is there some misconfiguration with Homestead 2.1.7 (box 0.4.0) preconfigured sourcelist?
PS. It would be greatly appreciated if Homestead's next versions would include options in configuration files for installing some pre-configured additional packages like MS SQL. Yes not everybody needs them, but with client projects there often comes need for more exotic packages than is found in #laragarden
vagrant#homestead:~$ sudo apt-get update
Hit http://apt.postgresql.org trusty-pgdg InRelease
Ign http://ppa.launchpad.net trusty InRelease
Ign http://us.archive.ubuntu.com trusty InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Ign http://ppa.launchpad.net trusty InRelease
Hit http://apt.postgresql.org trusty-pgdg/main amd64 Packages
Hit http://ppa.launchpad.net trusty InRelease
Get:1 http://us.archive.ubuntu.com trusty-updates InRelease [64.4 kB]
Hit http://ppa.launchpad.net trusty InRelease
Hit http://security.ubuntu.com trusty-security/main Sources
Ign http://dl.hhvm.com utopic InRelease
Hit http://apt.postgresql.org trusty-pgdg/main i386 Packages
Hit http://ppa.launchpad.net trusty Release.gpg
Hit http://security.ubuntu.com trusty-security/restricted Sources
Hit http://ppa.launchpad.net trusty Release.gpg
Ign http://dl.hhvm.com utopic Release.gpg
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Ign http://dl.hhvm.com utopic Release
Hit http://security.ubuntu.com trusty-security/multiverse Sources
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports InRelease
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Ign http://dl.hhvm.com utopic/main amd64 Packages/DiffIndex
Hit http://us.archive.ubuntu.com trusty Release.gpg
Hit http://ppa.launchpad.net trusty Release
Hit http://security.ubuntu.com trusty-security/restricted amd64 Packages
Hit http://ppa.launchpad.net trusty Release
Ign http://apt.postgresql.org trusty-pgdg/main Translation-en_US
Hit http://packages.blackfire.io any InRelease
Get:2 http://us.archive.ubuntu.com trusty-updates/main Sources [248 kB]
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Ign http://dl.hhvm.com utopic/main i386 Packages/DiffIndex
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Ign http://apt.postgresql.org trusty-pgdg/main Translation-en
Hit http://security.ubuntu.com trusty-security/multiverse amd64 Packages
Hit http://security.ubuntu.com trusty-security/main i386 Packages
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/restricted i386 Packages
Hit http://ppa.launchpad.net trusty/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/universe i386 Packages
Hit http://ppa.launchpad.net trusty/main i386 Packages
Hit http://security.ubuntu.com trusty-security/multiverse i386 Packages
Hit http://ppa.launchpad.net trusty/main Translation-en
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://packages.blackfire.io any/main amd64 Packages
Hit http://security.ubuntu.com trusty-security/multiverse Translation-en
Get:3 http://us.archive.ubuntu.com trusty-updates/restricted Sources [5,359 B]
Hit http://security.ubuntu.com trusty-security/restricted Translation-en
Get:4 http://us.archive.ubuntu.com trusty-updates/universe Sources [147 kB]
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:5 http://us.archive.ubuntu.com trusty-updates/multiverse Sources [5,161 B]
Hit http://packages.blackfire.io any/main i386 Packages
Get:6 http://us.archive.ubuntu.com trusty-updates/main amd64 Packages [689 kB]
Ign http://dl.hhvm.com utopic/main Translation-en_US
Ign http://dl.hhvm.com utopic/main Translation-en
Err http://dl.hhvm.com utopic/main amd64 Packages
404 Not Found [IP: 140.211.166.134 80]
Err http://dl.hhvm.com utopic/main i386 Packages
404 Not Found [IP: 140.211.166.134 80]
Get:7 http://us.archive.ubuntu.com trusty-updates/restricted amd64 Packages [15.9 kB]
Get:8 http://us.archive.ubuntu.com trusty-updates/universe amd64 Packages [334 kB]
Ign http://packages.blackfire.io any/main Translation-en_US
Get:9 http://us.archive.ubuntu.com trusty-updates/multiverse amd64 Packages [13.0 kB]
Get:10 http://us.archive.ubuntu.com trusty-updates/main i386 Packages [663 kB]
Ign http://packages.blackfire.io any/main Translation-en
Get:11 http://us.archive.ubuntu.com trusty-updates/restricted i386 Packages [15.6 kB]
Get:12 http://us.archive.ubuntu.com trusty-updates/universe i386 Packages [335 kB]
Get:13 http://us.archive.ubuntu.com trusty-updates/multiverse i386 Packages [13.1 kB]
Get:14 http://us.archive.ubuntu.com trusty-updates/main Translation-en [348 kB]
Get:15 http://us.archive.ubuntu.com trusty-updates/multiverse Translation-en [6,832 B]
Get:16 http://us.archive.ubuntu.com trusty-updates/restricted Translation-en [3,699 B]
Get:17 http://us.archive.ubuntu.com trusty-updates/universe Translation-en [175 kB]
Hit http://us.archive.ubuntu.com trusty-backports/main Sources
Hit http://us.archive.ubuntu.com trusty-backports/restricted Sources
Hit http://us.archive.ubuntu.com trusty-backports/universe Sources
Hit http://us.archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://us.archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com trusty-backports/main i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/restricted i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/universe i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/multiverse i386 Packages
Hit http://us.archive.ubuntu.com trusty-backports/main Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://us.archive.ubuntu.com trusty Release
Hit http://us.archive.ubuntu.com trusty/main Sources
Hit http://us.archive.ubuntu.com trusty/restricted Sources
Hit http://us.archive.ubuntu.com trusty/universe Sources
Hit http://us.archive.ubuntu.com trusty/multiverse Sources
Hit http://us.archive.ubuntu.com trusty/main amd64 Packages
Hit http://us.archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://us.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://us.archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://us.archive.ubuntu.com trusty/main i386 Packages
Hit http://us.archive.ubuntu.com trusty/restricted i386 Packages
Hit http://us.archive.ubuntu.com trusty/universe i386 Packages
Hit http://us.archive.ubuntu.com trusty/multiverse i386 Packages
Hit http://us.archive.ubuntu.com trusty/main Translation-en
Hit http://us.archive.ubuntu.com trusty/multiverse Translation-en
Hit http://us.archive.ubuntu.com trusty/restricted Translation-en
Hit http://us.archive.ubuntu.com trusty/universe Translation-en
Ign http://us.archive.ubuntu.com trusty/main Translation-en_US
Ign http://us.archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://us.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 3,083 kB in 35s (86.1 kB/s)
W: Failed to fetch http://dl.hhvm.com/ubuntu/dists/utopic/main/binary-amd64/Packages 404 Not Found [IP: 140.211.166.134 80]
W: Failed to fetch http://dl.hhvm.com/ubuntu/dists/utopic/main/binary-i386/Packages 404 Not Found [IP: 140.211.166.134 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
If you don't need HHVM you can remove it from sources.
Connect to vagrant machine:
vagrant ssh
Remove hhvm:
sudo rm -f /etc/apt/sources.list.d/hhvm.list
Update packages list:
sudo apt-get update
Exit from machine:
exit
Restart machine:
vagrant restart --provision

How to install php7?

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

Categories