I'm installing a LAMP stack on an Ubuntu instance in Google Compute Engine. I'm following the instructions at https://cloud.google.com/community/tutorials/setting-up-lamp where I'm instructed to enter sudo apt-get install apache2 php libapache2-mod-php

When I press Enter, I get this message: Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package php E: Unable to locate package libapache2-mod-php

Apparently Apache was installed because I can browse the page, but php and libapache2-mod-php are not found. Have the names been changed for these packages?

  • Chances are you need php5 or php7.x packages. Since PHP 7 came out I believe Ubuntu has started differentiating between the various versions. – ceejayoz Jul 20 '17 at 17:14

The ubuntu package is called php7.0

apt-get install php7.0

You may also want to use

apt-get install libapache2-mod-php7.0

In the future, you can check https://packages.ubuntu.com or run

apt-cache search php
| improve this answer | |

Packages names can diverge with ubuntu version. You can locate php packages names with a search command:

apt-cache search php

Be sure have an updated packages list before :

apt-get update
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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