Installing libapache2-mod-php7.1

13,911

Basically it should be installed during installation of PHP:

sudo apt-get install php7.1
...
The following NEW packages will be installed:
  libapache2-mod-php7.1 libssl1.0.2 php-common php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-readline

So first check if it is already installed:

dpkg -l | grep libapache2-mod-php7.1
ii  libapache2-mod-php7.1         7.1.7.retag-1+0~20170711133844.5+jessie~1.gbp5284f4 amd64        server-side, HTML-embedded scripting language (Apache 2 module)

In case it is not installed the following command should work fine:

sudo apt-get install libapache2-mod-php7.1

If it will fail check if it is available in repo:

apt-get update
apt-cache search libapache2-mod-php7.1

I used deb.sury.org for php 7.1:

apt-get install apt-transport-https 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/ jessie main" > /etc/apt/sources.list.d/php.list
apt-get update
Share:
13,911
Jordy Deweer
Author by

Jordy Deweer

Updated on June 14, 2022

Comments

  • Jordy Deweer
    Jordy Deweer about 2 years

    I installed Apache 2.4.27 and PHP 7.1.7 from source, but I don't find a tip about how to install libapache2-mod-php7.1 or the required module.

    How can I install libapache2-mod-php7.1 (or similar) to Apache 2 located under /user/local/apache2?

    I have to install it on Debian 8.8 Jessie.

    • Elvis Plesky
      Elvis Plesky almost 7 years
      What OS do you have?
    • Jordy Deweer
      Jordy Deweer almost 7 years
      @ElvisPlesky I am so sorry!! I realized that I should add that information last night... I just added it to my question :-) It is Debian 8.8 Jessie.
  • Jordy Deweer
    Jordy Deweer almost 7 years
    Okay, that worked. But is it possible to use latest versions of apache2 (2.4.27) and of MariaDB-server and Mariadb-client? or do you recommend nginx as server?