unable to locate package php7.0 and libapache2-mod-php7.0

Solution 1:

It appears you are missing the repository for php7.

Adding the php7 ppa:

  1. sudo add-apt-repository ppa:ondrej/php
  2. Then update:
    • sudo apt-get update
  3. Now do a search to confirm php7 is there:
    • sudo apt search php7
  4. Now install the php7 package:
    • sudo apt install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0

Solution 2:

I think you have a typo in your command, there is no existent package named php7.0libapache2-mod-php7.0, i think maybe a bad copy-paste led you to a wrong package name, correct names for such package could be libapache2-mod-php7.0 or simply libapache2-mod-php.

Also I do not agree too much with adding a ppa as a solution for this, since it can be done with ubuntu's official packages.

Since Xenial (16.04), php7.x is the default version, supported by Canonical, and has complete php7.x stack support without adding an "untrusted" ppa.

In practical terms it means that if you install php (and/or libapache2-mod-php in your case) metapackages, the subyacent working version of php and its libraries are going to be always from 7.x branch on Ubuntu 16.04+. Simply issuing sudo apt install php php-mysql php-curl php-json php-cgi libapache2-mod-php on a terminal, will led your system to a fully working php7.0 environment meeting your requirements.

I only recommend using ondrej's ppa, which otherwise i have used intensely, if you want or need unsupported php versions (php5.6 on 16.04 or 14.04, php7.0 on 14.04, etc).