42

I have "Ubuntu 14.04.2 LTS" OS and trying to install PHP7 using command:

sudo apt-get install php-7.0

Getting error message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php-7.0
E: Couldn't find any package by regex 'php-7.0'

sudo apt-get install php7.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0
E: Couldn't find any package by regex 'php7.0'

How it can be fix Please advise.

3
  • Your command doesn't match the output, since it has php-7.0 and the output has php7.0. Aside from that, there is no package with a name like that in the standard repositories. Are you trying to use a PPA? If so, perhaps askubuntu.com/a/705893/147763 can help.
    – Olathe
    Jan 2 '16 at 10:51
  • @Olathe: I have also tried commands: sudo apt-get install php-7.0 and sudo apt-get install php7.0 Jan 2 '16 at 10:57
  • 5
    How to install php 7, see:askubuntu.com/q/705880/476968 Jan 2 '16 at 10:59
84

PHP 7 is not available for Ubuntu Trusty in the standard Ubuntu repositories (2016-01-02).

You could use the PPA ppa:ondrej/php

sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
9
  • Thanks ! See the output of $php -v Below: PHP 7.0.1-4+deb.sury.org~vivid+1 (cli) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies Jan 2 '16 at 13:01
  • 2
    PHP6 doesn't exist, see the PHP website
    – wb9688
    Jan 2 '16 at 14:18
  • 1
    Not only does PHP 6 not exist, the naming scheme will change to php5.5, php5.6, etc. in coming versions.
    – muru
    Jan 2 '16 at 16:25
  • 6
    Does not work anymore on ubuntu 14. Not sure why but come up with errors E: Unable to locate package php7.0 E: Couldn't find any package by regex 'php7.0'. May 10 '19 at 9:47
  • 1
    @GeorgeMylonas - this is because the developer (ondrej) who puts together the php7 repo does not support EOL (end of life) releases (i.e. Ubuntu 14).
    – KJH
    Oct 15 '19 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.