tigernero
Posts: 88
Joined: Fri Dec 30, 2016 5:51 pm

How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 11:52 am

How to get latest apache2 and php versions on Raspbian Os

As many of you will know, Raspbian is optimized for our raspberry,
which in the lite version is extremely light and is suitable for various types of installations, including the LAMP web server.

Like all Debian derivatives, raspbian also lacks in having among its repositories the latest versions that we need for the security of our LAMP environment.

After various studies, I came to understand how to get the 2 main elements that make up a web server, apache and php.

as regards the installation of the latest php version, it will be sufficient to add the deb sury org repository to our os to then install or update them.

deb sury org contains the latest versions of php 7.0 / 7.1 / 7.2 / 7.3. in the nosytro case for those wishing to have php 7.3

just give these commands:

Code: Select all

1) sudo apt-get -y install apt-transport-https lsb-release ca-certificates

2) sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

3) sudo sh -c 'echo "deb https://packages.sury.org/php/ $ (lsb_release -sc) main"> /etc/apt/sources.list.d/php.list'

4) sudo apt update


having done that we could install any version of php, I will examine last php 7.3

just give command

Code: Select all

sudo apt-get install php7.3 libapache2-mod-php7.3 php7.3-cli php7.3-common php7.3-mbstring php7.3-gd php7.3-intl php7.3-xml php7. 3-mysql php7.3-zip php7.3-curl php7.3-ldap php7.3-bz2 php-ssh2 php-apcu php-smbclient php-imagick libmagickcore-dev -y


to have everything we need php 7.3 sources obviously you will also have last php 7.3-fpm if you want

FOR APACHE2 THE ISSUE WAS MORE COMPLEX

since the deb sury org repository is designed for os debian and not for its derivatives.

raspbian has in its repository apache2 version 2.4.25 which does not contain the latest security patches see apache 2.4.39

to be able to install the latest apache we need a library located in the stretch-backport repositories

reposities that are not installable on raspbian except with a guide that I created and resolves

Let's start by putting the apache2 repositories of deb sury org

APACHE

Code: Select all

1) sudo apt-get -y install apt-transport-https lsb-release ca-certificates

2) sudo wget -O /etc/apt/trusted.gpg.d/apache2.gpg https://packages.sury.org/apache2/apt.gpg

3) sudo sh -c 'echo "deb https://packages.sury.org/apache2/ $ (lsb_release -sc) main"> /etc/apt/sources.list.d/apache2.list'

4) sudo apt update
having done that we need the dependency of libbrotli1 that we don't have in raspbian and in order to get it we have to get it from the debian backport repository

I solved this way:

I added backport repository in source.list

Code: Select all

1) sudo nano /etc/apt/sources.list
I added

Code: Select all

deb http://deb.debian.org/debian stretch-backports main
I installed dirmngr which serves to get the keys of the repository

Code: Select all

2) sudo apt install dirmngr

added the following keys taken from ubuntu (those from debian didn't find them but they are the same

Code: Select all

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
I imported them in the apt-key

Code: Select all

sudo gpg -a --export 7638D0442B90D010 | sudo apt-key add -

sudo gpg -a --export 8B48AD6246925553 | sudo apt-key add -



installed the dependency that was missing with the command

Code: Select all

sudo apt-get -t stretch-backports install libbrotli1

and I tried to install apache2 and it worked

Code: Select all

sudo apt-get install apache2 -y
I got our working apache 2.4.39 on raspbian.

from this moment apache2 and php will always receive the latest versions available

Thanks to those who followed me here

User avatar
rpdom
Posts: 14138
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 12:05 pm

tigernero wrote:
Wed Apr 10, 2019 11:52 am
raspbian has in its repository apache2 version 2.4.25 which does not contain the latest security patches see apache 2.4.39
Which patches are missing?

Debian based systems always backport the security patches to the older stable versions of all software. That is one of the main reasons people use it.
Signature is on holiday.

fruitoftheloom
Posts: 19508
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 1:15 pm

tigernero wrote:
Wed Apr 10, 2019 11:52 am
How to get latest apache2 and php versions on Raspbian Os

As many of you will know, Raspbian is optimized for our raspberry,
which in the lite version is extremely light and is suitable for various types of installations, including the LAMP web server.

Like all Debian derivatives, raspbian also lacks in having among its repositories the latest versions that we need for the security of our LAMP environment.

After various studies, I came to understand how to get the 2 main elements that make up a web server, apache and php.

as regards the installation of the latest php version, it will be sufficient to add the deb sury org repository to our os to then install or update them.

deb sury org contains the latest versions of php 7.0 / 7.1 / 7.2 / 7.3. in the nosytro case for those wishing to have php 7.3

just give these commands:

Code: Select all

1) sudo apt-get -y install apt-transport-https lsb-release ca-certificates

2) sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

3) sudo sh -c 'echo "deb https://packages.sury.org/php/ $ (lsb_release -sc) main"> /etc/apt/sources.list.d/php.list'

4) sudo apt update


having done that we could install any version of php, I will examine last php 7.3

just give command

Code: Select all

sudo apt-get install php7.3 libapache2-mod-php7.3 php7.3-cli php7.3-common php7.3-mbstring php7.3-gd php7.3-intl php7.3-xml php7. 3-mysql php7.3-zip php7.3-curl php7.3-ldap php7.3-bz2 php-ssh2 php-apcu php-smbclient php-imagick libmagickcore-dev -y


to have everything we need php 7.3 sources obviously you will also have last php 7.3-fpm if you want

FOR APACHE2 THE ISSUE WAS MORE COMPLEX

since the deb sury org repository is designed for os debian and not for its derivatives.

raspbian has in its repository apache2 version 2.4.25 which does not contain the latest security patches see apache 2.4.39

to be able to install the latest apache we need a library located in the stretch-backport repositories

reposities that are not installable on raspbian except with a guide that I created and resolves

Let's start by putting the apache2 repositories of deb sury org

APACHE

Code: Select all

1) sudo apt-get -y install apt-transport-https lsb-release ca-certificates

2) sudo wget -O /etc/apt/trusted.gpg.d/apache2.gpg https://packages.sury.org/apache2/apt.gpg

3) sudo sh -c 'echo "deb https://packages.sury.org/apache2/ $ (lsb_release -sc) main"> /etc/apt/sources.list.d/apache2.list'

4) sudo apt update
having done that we need the dependency of libbrotli1 that we don't have in raspbian and in order to get it we have to get it from the debian backport repository

I solved this way:

I added backport repository in source.list

Code: Select all

1) sudo nano /etc/apt/sources.list
I added

Code: Select all

deb http://deb.debian.org/debian stretch-backports main
I installed dirmngr which serves to get the keys of the repository

Code: Select all

2) sudo apt install dirmngr

added the following keys taken from ubuntu (those from debian didn't find them but they are the same

Code: Select all

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
I imported them in the apt-key

Code: Select all

sudo gpg -a --export 7638D0442B90D010 | sudo apt-key add -

sudo gpg -a --export 8B48AD6246925553 | sudo apt-key add -



installed the dependency that was missing with the command

Code: Select all

sudo apt-get -t stretch-backports install libbrotli1

and I tried to install apache2 and it worked

Code: Select all

sudo apt-get install apache2 -y
I got our working apache 2.4.39 on raspbian.

from this moment apache2 and php will always receive the latest versions available

Thanks to those who followed me here

Alternatively you could run Buster Lite Testing ???
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

tigernero
Posts: 88
Joined: Fri Dec 30, 2016 5:51 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 1:37 pm

you wouldn't still have the latest versions as from the Deb sury org repository

tigernero
Posts: 88
Joined: Fri Dec 30, 2016 5:51 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 1:39 pm

rpdom wrote:
Wed Apr 10, 2019 12:05 pm
tigernero wrote:
Wed Apr 10, 2019 11:52 am
raspbian has in its repository apache2 version 2.4.25 which does not contain the latest security patches see apache 2.4.39
Which patches are missing?

Debian based systems always backport the security patches to the older stable versions of all software. That is one of the main reasons people use it.
https://bobcares.com/blog/apache-2-4-x- ... erability/

the slowness in having the latest apache2 and PHP versions is the reason why I made this guide. let's not forget that raspbian uses basic PHP 7.0 deprecated by now.

fruitoftheloom
Posts: 19508
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 1:47 pm

tigernero wrote:
Wed Apr 10, 2019 1:39 pm
rpdom wrote:
Wed Apr 10, 2019 12:05 pm
tigernero wrote:
Wed Apr 10, 2019 11:52 am
raspbian has in its repository apache2 version 2.4.25 which does not contain the latest security patches see apache 2.4.39
Which patches are missing?

Debian based systems always backport the security patches to the older stable versions of all software. That is one of the main reasons people use it.
https://bobcares.com/blog/apache-2-4-x- ... erability/

the slowness in having the latest apache2 and PHP versions is the reason why I made this guide. let's not forget that raspbian uses basic PHP 7.0 deprecated by now.

Buster has PHP7.3

https://packages.debian.org/buster/php7.3

Apache 2.4.38

https://packages.debian.org/buster/apache2
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

tigernero
Posts: 88
Joined: Fri Dec 30, 2016 5:51 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 1:50 pm

Deb sury org apache2 versione 2.4.39
Deb sury org PHP 7.3.3
Attachments
Immagine3.png
Immagine3.png (12.46 KiB) Viewed 1296 times
Immagine3.png
Immagine3.png (12.46 KiB) Viewed 1297 times

User avatar
rpdom
Posts: 14138
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 2:02 pm

tigernero wrote:
Wed Apr 10, 2019 1:39 pm
rpdom wrote:
Wed Apr 10, 2019 12:05 pm
tigernero wrote:
Wed Apr 10, 2019 11:52 am
raspbian has in its repository apache2 version 2.4.25 which does not contain the latest security patches see apache 2.4.39
Which patches are missing?

Debian based systems always backport the security patches to the older stable versions of all software. That is one of the main reasons people use it.
https://bobcares.com/blog/apache-2-4-x- ... erability/
Fixed (along with others) in the current 2.4.25 release on Stretch.

Code: Select all

apache2 (2.4.25-3+deb9u7) stretch-security; urgency=medium

  [ Xavier Guimard ]
  * CVE-2018-17199: mode_session: Fix missing check for session expiry time.
    Closes: #920303

  [ Stefan Fritsch ]
  * mod_http2: Fix keepalive timeout behavior. This fixes a regression with
    Safari web browsers, introduced in 2.4.25-3+deb9u6. Closes: #915103
  * Fix typo in apache2_switch_mpm() in apache2-maintscript-helper.
    Closes: #904150
  * CVE-2018-17189: mod_http2: Fix DoS via slow, unneeded request bodies.
    Closes: #920302
  * CVE-2019-0196: mod_http2: Fix read after free
  * CVE-2019-0211: All MPMs: privilege escalation from www-data user to root.
  * CVE-2019-0217: mod_auth_digest: Access control bypass
  * CVE-2019-0220: URL normalization inconsistincy.
    Consecutive slashes in URL's are now merged before use in LocationMatch
    and RewriteRule. The old behavior can be restored with the new directive
    "MergeSlashes off".

 -- Stefan Fritsch <[email protected]>  Tue, 02 Apr 2019 21:05:13 +0200
Signature is on holiday.

tigernero
Posts: 88
Joined: Fri Dec 30, 2016 5:51 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 2:03 pm

ok I've read all the way through now, but why isn't it possible to have the latest release instead of making a bug fix on the current 2.4.25?

to have a basic version of php 7.3 in raspbian you will have to wait a lot?

User avatar
rpdom
Posts: 14138
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 2:16 pm

tigernero wrote:
Wed Apr 10, 2019 2:03 pm
ok I've read all the way through now, but why isn't it possible to have the latest release instead of making a bug fix on the current 2.4.25?
Because that is the whole point of Debian's Stable release system. Once a release is classed as stable you are guaranteed that software versions will not change and only backported security patches will be released. This can be critical in a production server environment where you don't want to be doing upgrades because of security fixes and suddenly find the "--banana" option to the "fruity" package suddenly produces oranges instead, or doesn't even exist any more and your critical server will no longer start (I have seen it happen on other systems where sysadmins thought they were being clever with upgrading to the latest version all the time). Yes, adequate testing should catch things like that, but it doesn't always.

Newer versions are available in Debian's (and Raspbian, of course) Testing release, called Buster. Buster is getting close to replacing Stretch as the new Stable release and Stretch will become Oldstable. There will then be a new Testing branch.
Signature is on holiday.

tigernero
Posts: 88
Joined: Fri Dec 30, 2016 5:51 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 2:19 pm

I noticed that to update apache2 to 2.4.39 from the repository odrej lacked the package: "libbrotli1"

which is why I had to force installation of the debian backport repository
and find it there and install it with the command

Code: Select all

sudo apt-get -t stretch-backports install libbrotli1
does this package exist in the buster channel if desired?

or is it only found in debian backport?

how to enable Debian's (and Raspbian, of course) correctly on raspbian?

fruitoftheloom
Posts: 19508
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 2:23 pm

It would appear that the OP requires a rolling release which is not Debian, Arch Linux Arm should fit:

https://archlinuxarm.org

php 7.3.4-2
https://archlinuxarm.org/packages/armv7h/php

apache 2.4.39-1
https://archlinuxarm.org/packages/armv7h/apache

brotli 1.0.7-1
https://archlinuxarm.org/packages/armv7h/brotli
Last edited by fruitoftheloom on Wed Apr 10, 2019 2:27 pm, edited 1 time in total.
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

fruitoftheloom
Posts: 19508
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: How to get latest apache2 and php versions on Raspbian Os

Wed Apr 10, 2019 2:26 pm

tigernero wrote:
Wed Apr 10, 2019 2:19 pm
I noticed that to update apache2 to 2.4.39 from the repository odrej lacked the package: "libbrotli1"

which is why I had to force installation of the debian backport repository
and find it there and install it with the command

Code: Select all

sudo apt-get -t stretch-backports install libbrotli1
does this package exist in the buster channel if desired?

or is it only found in debian backport?

how to enable Debian's (and Raspbian, of course) correctly on raspbian?

https://packages.debian.org/buster/libbrotli1
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

castletonroad
Posts: 64
Joined: Sat Jul 25, 2015 11:23 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Wed May 01, 2019 11:07 am

Hmmm...

I followed OP's advice, but Nextcloud was still reporting PHP7.0xxx, despite php -v showing that PHP7.3 was installed.

I purged 7.0x.... and then my Apache setup stopped working - couldn't process php pages.

Wasn't sure where to go with this, so have reverted to PHP7.0x as per stretch...
Raspberry Pi 3 Model B | Raspberry Pi 2 Model B

planteg
Posts: 13
Joined: Tue Apr 26, 2016 10:04 pm

Re: How to get latest apache2 and php versions on Raspbian Os

Fri May 10, 2019 3:50 pm

Hi,

using the latest Noobs (April 2019) I installed Raspbian, the I ran the first commands. All was well but for the last one:

Code: Select all

Err:5 https://packages.sury.org/php $ Release                
  404  Not Found
E: The repository 'https://packages.sury.org/php $ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.  
Could latest changes explain the issues ? I can provide the complete output if that helps. I will carry on with the other instructions and post back the result

My goal is to istall LAMP in order to install Joomla! I have had many issues using what worked for me before.

Thanks

EDIT

I couldn't install PHP 7.3. I first got a zillion of (the messages are in French, I translated this one in English like this):

Code: Select all

Note : selection of php7.0-apcu for rational expression « php7. »
That was followed by a zillion of messages like this one :

Code: Select all

E: Couldn't find any package by glob 'php7.3'
Why in the world is it so complicated to install packages

Gilles Plante

Return to “Raspbian”