How do I install PHP7 on Ubuntu 14.04?

33,759

Solution 1

You need to add additional repository, as php7 is not available for your distro version. Please make sure to clean all php packages and dependencies you have installed. Then proceed with:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0

Solution 2

Type the following command:

sudo apt-get install -y language-pack-en-base 
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

Or:

sudo add-apt-repository ppa:ondrej/php

Update the package index. To resynchronize the package index files from their sources, enter:

sudo apt-get update

List all PHP 7 packages

Type the following apt-cache command:

apt-cache search php7

Install PHP 7

Type the following command to install PHP 7 along with useful php modules such as MySQL, GD, curl and so on:

sudo apt-get install php7.0

Or

sudo apt-get install php7.0 php7.0-cli php7.0-fpm php7.0-gd \
   php7.0-json php7.0-mysql php7.0-readline
Share:
33,759

Related videos on Youtube

leecarter
Author by

leecarter

Updated on September 18, 2022

Comments

  • leecarter
    leecarter almost 2 years

    When I try to install PHP7 form this command:

    sudo apt-get install php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-cgi
    

    Then I get error:

    couldn't find or unable to locate all these packages.
    

    So I want to download php7.1 from php.net, then run with Apache. What is the process to do that? How to configure files like apache2.conf & php.ini to run PHP?

    • 13dimitar
      13dimitar over 7 years
      ubuntu version?
    • leecarter
      leecarter over 7 years
      @Dimitar actually i am using LinuxMint 17.2, Ubuntu 14.04
    • Mark Kirby
      Mark Kirby over 7 years
      Sorry but we do not support Mint, official Ubuntu only. Please ask at unix.stackexchange.com
  • leecarter
    leecarter over 7 years
    Thanks but i want manually like download folder than run
  • Melebius
    Melebius over 7 years
    @leecarter Ehm, why would anyone bother to do so while having APT?
  • Piyin
    Piyin almost 7 years
    Doesn't seem to be working anymore, I'm getting: Cannot add PPA: 'ppa:ondrej/php'. Please check that the PPA name or format is correct.