Cannot install php 7.2 on Raspbian

11,281

Solution 1

I found the reason, the package php7.1 and php7.2 isn't in the stretch repo :(.

https://raspberrypi.stackexchange.com/questions/70388/how-to-install-php-7-1

Have to wait an update ...

Solution 2

Please check this GitHub issue: https://github.com/oerdnj/deb.sury.org/issues/579

It seems that Debian packages for newer PHP versions are not yet released for the ARM architecture. I would like to contribute for building such packages, but there is no activity on the issue after my last post.

An option to install PHP7.1 or newer would be to compile and install it yourself. For some examples, you may want to check http://yoestuve.es/blog/compile-php-7-for-raspberry-pi-with-memcached/. I would also suggest to use checkinstall instead of make install in order to facilitate easier uninstallation later.

Share:
11,281
dicotout
Author by

dicotout

Updated on June 04, 2022

Comments

  • dicotout
    dicotout almost 2 years

    I cannot install php 7.2 on Raspbian. I used the last Raspbian (Release date : 2017-11-29) with a Debian Stretch 9.1 : https://www.raspberrypi.org/downloads/raspbian/

    I followed the instructions from https://www.colinodell.com/blog/2016-12/installing-php-7-1 :

    apt-get install apt-transport-https lsb-release ca-certificates
    wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
    apt-get update
    

    But when I try

    apt-get install -y php7.2
    

    A get the below errors :

    root@raspberrypi:/home/pi# apt-get install -y php7.2
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    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.2 : Depends: libapache2-mod-php7.2 but it is not installable or
                   php7.2-fpm but it is not installable or
                   php7.2-cgi but it is not installable
          Depends: php7.2-common but it is not installable
    E: Unable to correct problems, you have held broken packages.
    

    Someone can help me ? Thanks a lot

    • Gui-Don
      Gui-Don over 6 years
      Is this repository providing ARM binaries? I’m not sure, this might be why you can’t install it.
    • Gui-Don
      Gui-Don over 6 years
      EDIT: apparently it does. Did you check lsb_release -sc returned “stretch”? Does apt-get update downloaded this repo too?
    • dicotout
      dicotout over 6 years
      Yes, it return "Stretch".
    • Gui-Don
      Gui-Don over 6 years
      Can you retry install php7.1 at least? sudo apt-get update && sudo apt-get upgrade && sudo apt-get install php7.1
    • dicotout
      dicotout over 6 years
      The result is unfortunatly the same : The following packages have unmet dependencies: php7.1 : Depends: libapache2-mod-php7.1 but it is not installable or php7.1-fpm but it is not installable or php7.1-cgi but it is not installable Depends: php7.1-common but it is not installable E: Unable to correct problems, you have held broken packages.
  • Gui-Don
    Gui-Don over 6 years
    That’s exactly why you added the https://packages.sury.org/php/ repo. As a result, apt should download php from the sury.org repository, not the (default) stretch one. I installed php7.1 on stretch several times (also it’s very likely php will stay at 7.0 during the whole stretch life).
  • Kaspars Foigts
    Kaspars Foigts over 6 years
    For stretch there are only php7.1 and php7.1-xsl. Same for 7.2 within sury.org repo.