Ubuntu – Getting error from apt-get when trying to install php5 package


I am new in ubuntu and I try to run a website by my own computer but I can't install php5. When i typed:

sudo apt-get install php5

I received:

Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is
only available from another source

E: Package 'php5' has no installation candidate

What does it mean?

Best Answer

php5 is actually a meta-package. You should decide, whether you want to use the php5-module for apache or install the CLI/CGI-version and use that.

I'll just assume you want to go with the first option: try apt-get install libapache2-mod-php5. If that still doesn't work, check apt-cache search php5 and see if the packages are even in there, might be some mishap in your apt repository configuration.

Note: For php7, the package name is libapache2-mod-php7.0 and NOT libapache2-mod-php7 (Ubuntu 16.04).