45

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.

Braiam
  • 67,791
  • 32
  • 179
  • 269
Ramesh Chand
  • 7,274
  • 4
  • 33
  • 37
  • 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 https://askubuntu.com/a/705893/147763 can help. – Olathe Jan 02 '16 at 10:51
  • @Olathe: I have also tried commands: sudo apt-get install php-7.0 and sudo apt-get install php7.0 – Ramesh Chand Jan 02 '16 at 10:57
  • 5
    How to install php 7, see:http://askubuntu.com/q/705880/476968 – Tshilidzi Mudau Jan 02 '16 at 10:59

1 Answers1

87

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
oerdnj
  • 7,940
A.B.
  • 90,397
  • 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

    – Ramesh Chand Jan 02 '16 at 13:01
  • 2
    PHP6 doesn't exist, see the PHP website – wb9688 Jan 02 '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 02 '16 at 16:25
  • Need phpmyadmin, there is no php7.0-phpmyadmin, php5.6-phpmyadmin or php5.5-phpmyadmin, nor phpmyadmin compatible with your php. – happy_marmoset Oct 24 '16 at 07:21
  • Hello, I want to add php7.2 on my server in ubuntu 15.10. Is it possible? – Amit Kumar Aug 16 '18 at 05:37
  • I perfromed above mention command and still i am getting error of unable to locate package of php7.3. I updated apt-get update also – Dipti Mar 13 '19 at 07:16
  • 7
    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'. – George Mylonas May 10 '19 at 09:47
  • getting this Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package php7.2 E: Couldn't find any package by regex 'php7.2' – Vishwas Nahar Jul 12 '19 at 07:27
  • 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