I newly install Dompdf in Laravel Project via Composer (composer require barryvdh/laravel-dompdf). After enter the Command Terminal Reply Following Errors.
Problem 1
- dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- barryvdh/laravel-dompdf v0.7.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
- Installation request for barryvdh/laravel-dompdf ^0.7.0 -> satisfiable by barryvdh/laravel-dompdf[v0.7.0].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/5.6/cli/php.ini
- /etc/php/5.6/cli/conf.d/10-opcache.ini
- /etc/php/5.6/cli/conf.d/10-pdo.ini
- /etc/php/5.6/cli/conf.d/15-xml.ini
- /etc/php/5.6/cli/conf.d/20-calendar.ini
- /etc/php/5.6/cli/conf.d/20-ctype.ini
- /etc/php/5.6/cli/conf.d/20-dom.ini
- /etc/php/5.6/cli/conf.d/20-exif.ini
- /etc/php/5.6/cli/conf.d/20-fileinfo.ini
- /etc/php/5.6/cli/conf.d/20-ftp.ini
- /etc/php/5.6/cli/conf.d/20-gettext.ini
- /etc/php/5.6/cli/conf.d/20-iconv.ini
- /etc/php/5.6/cli/conf.d/20-json.ini
- /etc/php/5.6/cli/conf.d/20-mbstring.ini
- /etc/php/5.6/cli/conf.d/20-phar.ini
- /etc/php/5.6/cli/conf.d/20-posix.ini
- /etc/php/5.6/cli/conf.d/20-readline.ini
- /etc/php/5.6/cli/conf.d/20-shmop.ini
- /etc/php/5.6/cli/conf.d/20-simplexml.ini
- /etc/php/5.6/cli/conf.d/20-sockets.ini
- /etc/php/5.6/cli/conf.d/20-sysvmsg.ini
- /etc/php/5.6/cli/conf.d/20-sysvsem.ini
- /etc/php/5.6/cli/conf.d/20-sysvshm.ini
- /etc/php/5.6/cli/conf.d/20-tokenizer.ini
- /etc/php/5.6/cli/conf.d/20-wddx.ini
- /etc/php/5.6/cli/conf.d/20-xmlreader.ini
- /etc/php/5.6/cli/conf.d/20-xmlwriter.ini
- /etc/php/5.6/cli/conf.d/20-xsl.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
How to Solve this Error
I already Installed GD using Following comment. sudo apt-get install php5-gd and also Apache Server Restarted. My Laravel Version is 5.3 and Ubuntu Version is 14.04
I have installed php7, I did the following to solve exactly the same error
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-intl
sudo apt-get install php7.0-xsl
If you are working in PHP version 5.* then you have to install
sudo apt-get install php5-gd
And if you are working in PHP version 7.* then you have to install
sudo apt-get install php7.0-gd
Hope it will work...
And if you are working in PHP version 7.2 then you have to install
sudo apt-get install php7.2-gd... it worked for me
For php-8, just locate your php.ini file and uncomment the line extension=gd
Below is a picture guide for those using Xampp and Windows
Step 1: Open php.ini or locate it in your machine (C:/xampp/php/php.ini)
Step 2: Uncomment the line extension=gd by removing the semicolon
Step 3: Save your file and restart your services
Open your php.ini and uncomment this line:
;extension=php_gd2.dll
It may not be enabled for php-cli, you can enable like this;
sudo phpenmod gd
UPDATE
I guess, you are using ppa:ondrej php package (5.6), which is confusing you with default ubuntu 14.04 php package (5.5.9).
To install php 5.6 gd library from ppa:ondrej, you should use:
sudo apt-get install php5.6-gd
PHP 7.4.2 (cli) (built: Feb 5 2020 16:50:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies
For Php 7.4.2
sudo apt-get install php7.4-gd
sudo phpenmod gd
Before installing the missing dependency, you need to check which version of PHP is installed on your system.
php -v
PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
In this case it's php7.2. apt search php7.2 returns all the available PHP extensions.
apt search php7.2
Sorting... Done
Full Text Search... Done
libapache2-mod-php7.2/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
server-side, HTML-embedded scripting language (Apache 2 module)
libphp7.2-embed/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
HTML-embedded scripting language (Embedded SAPI library)
php-all-dev/bionic,bionic 1:60ubuntu1 all
package depending on all supported PHP development packages
php7.2/bionic-updates,bionic-updates,bionic-security,bionic-security 7.2.10-0ubuntu0.18.04.1 all
server-side, HTML-embedded scripting language (metapackage)
php7.2-bcmath/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Bcmath module for PHP
php7.2-bz2/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
bzip2 module for PHP
php7.2-cgi/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
server-side, HTML-embedded scripting language (CGI binary)
php7.2-cli/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
command-line interpreter for the PHP scripting language
php7.2-common/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
documentation, examples and common module for PHP
php7.2-curl/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
CURL module for PHP
php7.2-dba/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
DBA module for PHP
php7.2-dev/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Files for PHP7.2 module development
php7.2-enchant/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Enchant module for PHP
php7.2-fpm/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.2-gd/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
GD module for PHP
php7.2-gmp/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
GMP module for PHP
php7.2-imap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
IMAP module for PHP
php7.2-interbase/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Interbase module for PHP
php7.2-intl/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Internationalisation module for PHP
php7.2-json/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
JSON module for PHP
php7.2-ldap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
LDAP module for PHP
php7.2-mbstring/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
MBSTRING module for PHP
php7.2-mysql/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
MySQL module for PHP
php7.2-odbc/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
ODBC module for PHP
php7.2-opcache/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
Zend OpCache module for PHP
php7.2-pgsql/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
PostgreSQL module for PHP
php7.2-phpdbg/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
server-side, HTML-embedded scripting language (PHPDBG binary)
php7.2-pspell/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
pspell module for PHP
php7.2-readline/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed,automatic]
readline module for PHP
php7.2-recode/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
recode module for PHP
php7.2-snmp/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
SNMP module for PHP
php7.2-soap/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
SOAP module for PHP
php7.2-sqlite3/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
SQLite3 module for PHP
php7.2-sybase/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Sybase module for PHP
php7.2-tidy/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
tidy module for PHP
php7.2-xml/bionic-updates,bionic-security,now 7.2.10-0ubuntu0.18.04.1 amd64 [installed]
DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.2-xmlrpc/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
XMLRPC-EPI module for PHP
php7.2-xsl/bionic-updates,bionic-updates,bionic-security,bionic-security 7.2.10-0ubuntu0.18.04.1 all
XSL module for PHP (dummy)
php7.2-zip/bionic-updates,bionic-security 7.2.10-0ubuntu0.18.04.1 amd64
Zip module for PHP
You can now proceed to installing the missing dependency by running:
sudo apt install php7.2-gd
if you are working in PHP version 7.2 then you have to install
sudo apt-get install php7.2-gd
For php 7.1
sudo apt-get install php7.1-gd
Cheers!
I'm working on php 8.0.9, and I just uncomment this on php.ini in xampp/php/php.ini directory.
from
;extension=gd
to
extension=gd
and it's work normal again
The solution is quite simple.
In your php.ini, just uncomment the line extension=php_gd2.dll (or .so extension for unix systems.)
Hope it helps.
This worked for me:
composer require "ext-gd:*" --ignore-platform-reqs
As of Composer 2.0 on Arch, I use: --ignore-platform-req=ext-gd
Eg:
php composer install -n --ignore-platform-req=ext-gd
Eg: (to ignore multiple requirements)
php composer install -n --ignore-platform-req=ext-gd --ignore-platform-req=ext-ldap
Ignoring Composer requirements may be necessary because Composer may return false warnings on dependencies that are already properly installed and enabled, consider this Arch forum article:
I have installed php-gd and uncommeted extension=gd.so in /etc/php/php.ini as the wiki says
Thanks for this answer on a related Question, How to always use ignore-platform-reqs flag when running composer?
Using Manjaro(Arch) Linux:
$ sudo pacman -S php-gd
In file /etc/php/php-ini, add the line:
extension=gd.so
For Windows :
Uncomment this line in your php.ini file
;extension=php_gd2.dll
If the above step doesn't work uncomment the following line as well:
;extension=gd2
sudo apt-get install php7.4-zip
Use your version of php. Like here I used 7.4
CentOS
sudo yum install php-gd
Unbuntu
sudo apt install php-gd
First Check your php version
sudo php -v
Then install php gd package of relevent version.
sudo apt-get install php${version}-gd
Finally run
composer update
On CentOS 7, try running following command:
sudo yum install php72u-gd.x86_64
in docker I found a same problem, even after
"rm /etc/apt/preferences.d/no-debian-php"
then
"apt update"
"apt install php7.4-gd"
"php composer.phar update"
error " ..... ext-gd ....."
so my solution is direct using php7.4
"php7.4 composer.phar update"
and its work. I dont know why.
It may help you
apt install php-xml
systemctl restart apache2
From reference here, you may learn in brief.
Thanks :)
On Local or Xampp in windows
go to : C:\xampp\php\php.ini
uncomment extension=gd
PHP VERSION - 7.3.21
WAMP SERVER
// use below command to fix ext-gd issue
// work for me
composer require "ext-gd:*" --ignore-platform-reqs phpoffice/phpspreadsheet
I am using shippable to build my project and part of it requires PHP.
The build script is this:
apt-get update
apt-get install -y software-properties-common python-software-properties language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php7.0 php7.0-bcmath
Today the build failed while installing PHP with the following error:
apt-get install -y php7.0 php7.0-bcmath
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.0 : Depends: libapache2-mod-php7.0 but it is not going to be installed or
php7.0-fpm but it is not going to be installed or
php7.0-cgi but it is not going to be installed
Depends: php7.0-common but it is not going to be installed
php7.0-bcmath : Depends: php7.0-common but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So i started up a local docker container to see if something wierd was happening at shippable - with the following command:
docker run -i -t ubuntu:14.04 /bin/bash
And ran the 5 build lines listed above, and i get the same error. The next thing i did was install aptitude to see if i could get a better error, and ran this aptitude install -y php7.0 php7.0-bcmath - this was the aptitude output:
aptitude install -y php7.0 php7.0-bcmath
The following NEW packages will be installed:
apache2{a} apache2-bin{a} apache2-data{a} libapache2-mod-php7.0{ab}
libapr1{a} libaprutil1{a} libaprutil1-dbd-sqlite3{a} libaprutil1-ldap{a}
libedit2{a} php-common{a} php7.0 php7.0-bcmath php7.0-cli{ab}
php7.0-common{ab} php7.0-json{a} php7.0-opcache{a} php7.0-readline{a}
psmisc{a} ssl-cert{a}
0 packages upgraded, 19 newly installed, 0 to remove and 7 not upgraded.
Need to get 4950 kB of archives. After unpacking 20.2 MB will be used.
The following packages have unmet dependencies:
php7.0-cli : Depends: libssl1.1 (>= 1.1.0) which is a virtual package.
php7.0-common : Depends: libssl1.1 (>= 1.1.0) which is a virtual package.
libapache2-mod-php7.0 : Depends: libssl1.1 (>= 1.1.0) which is a virtual package.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libapache2-mod-php7.0 [Not Installed]
2) php7.0 [Not Installed]
3) php7.0-bcmath [Not Installed]
4) php7.0-cli [Not Installed]
5) php7.0-common [Not Installed]
6) php7.0-json [Not Installed]
7) php7.0-opcache [Not Installed]
8) php7.0-readline [Not Installed]
The following NEW packages will be installed:
psmisc{a}
0 packages upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 53.2 kB of archives. After unpacking 229 kB will be used.
Get: 1 http://archive.ubuntu.com/ubuntu/ trusty/main psmisc amd64 22.20-1ubuntu2 [53.2 kB]
Fetched 53.2 kB in 0s (911 kB/s)
Selecting previously unselected package psmisc.
(Reading database ... 14894 files and directories currently installed.)
Preparing to unpack .../psmisc_22.20-1ubuntu2_amd64.deb ...
Unpacking psmisc (22.20-1ubuntu2) ...
Setting up psmisc (22.20-1ubuntu2) ...
I have a couple of questions:
1) How do i fix this? I have done some looking but can't work out how to update libssl
2) Why has this happened all of a sudden, this was never a problem for PHP7.0 before?
Some additional info:
openssl version -a
OpenSSL 1.0.1f 6 Jan 2014
built on: Mon Jan 30 20:38:38 UTC 2017
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/usr/lib/ssl"
uname -a
Linux b5cbe94d7da8 4.9.13-moby #1 SMP Sat Mar 25 02:48:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
The PPA maintainer has 'fixed' this, according to a GitHub issue.
To answer your questions:
1) How do i fix this? I have done some looking but can't work out how to update libssl
The PPA has been already fixed, but next time, please, fill an issue at appropriate place - e.g. the issue tracker.
2) Why has this happened all of a sudden, this was never a problem for PHP7.0 before?
The packages in ppa:ondrej/php build-depends on ppa:ondrej/apache2 that has been recently updated to OpenSSL 1.1.0 libraries, and those were picked up by latest build of PHP. The ppa:ondrej/php had to be updated with OpenSSL 1.1.0 libraries as well as a consequence of this move.
A bug or two occasionally happens, and it is fixed as soon as the bug is filled at appropriate place.
It is perfectly safe to mix more versions of OpenSSL even in the same binary becase OpenSSL uses proper SONAMEs and all the symbols in the shared library are versioned.
"PHP module gd: Missing" I received such an error. and I'm trying to install php5-gd.
apt-get install php5-gd
I am using Ubuntu 16.10 and PHP version 7. I made all the updates.
When I tried to install php5-gd, I got an error like below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5-gd' has no installation candidate
First check which php version you have by sudo php -v. I have php7 so the result is:
PHP 7.0.18-0ubuntu0.17.04.1 (cli) (built: Apr 26 2017 23:59:48) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies
since i have php7, I will do the following to list the php packages
sudo apt-cache search php7-*
this returned
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
...and do on
now to install packages run the following command with your desired package
sudo apt-get install php7.0-mysql php7.0-gd php7.0-curl php7.0-recode
note:php7.0-mysql php7.0-gd php7.0-curl php7.0-recode are the package that are listed above.
UPDATE
dont forget to restart apache sudo service apache2 reload
You can use the meta-paclaget php-gd, which is an alias of php7.0-gd
sudo apt-get install php-gd
Please check php version and install modules
apt-get update
apt-get install php5.6-gd
If you want other modules then use this command to get all available modules
apt-cache search php5.*
you have php7 installed but you are trying to install a package of php5 that is the problem
Same issue here.
Use RUN rm /etc/apt/preferences.d/no-debian-php in dockerfile
Also you can see here the solution https://hub.docker.com/_/php
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