Unable to locate package libapache2-mod-php7

Unable to locate package libapache2-mod-php7



I tried installing php in ubuntu 16.04 using following command:


sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7



but it says



Unable to locate package libapache2-mod-php7



Should I skip this or install by an alternative way?




9 Answers
9



The name of the package is libapache2-mod-php7.0
Try again by having that .0 at the end and it should work.


libapache2-mod-php7.0


.0






Great. It worked.

– Vagabond
Dec 24 '16 at 7:03






worked for me. Thanks

– Abdulla
Jul 12 '17 at 9:46






yah, worked for me too.. Thanx lots.

– Araali Farooq
Nov 24 '17 at 16:18



If you are using Ubuntu 17.04/17.10 use php7.1 instead of 7.0 since it's no longer available.


sudo apt-get install php7.1



It is likely the case that your local package index is not updated; try


sudo apt-get update



and then run the previous command again.



As an aside, there is now a program apt that is supposedly more user-friendly than apt-get, apt-cache etc. (see this question on Ask Ubuntu). So your commands could have been replaced by


apt


apt-get


apt-cache


sudo apt update
sudo apt install <the packages>



to get a slightly nicer user interface.



Probably this question would have been better suited to the Ask Ubuntu community.



At the time of the post Ubuntu 16.04 was one of the newer versions and as such the packages changed to php7.0 but as time goes on it will be 7.1 to 7.2 etc... and I don't have the time to figure out what was the latest package and I'm not dependent on a specific version.
So if you want the latest version of packages to install without having to know the correct version number just drop the version number and the latest applicable to the distribution you are using will be installed.
In my case I was using Ubuntu 17.10 and the php version is different so I used the following command line to get the latest.


sudo apt-get install apache2 php-mysql libapache2-mod-php mysql-server



It installed php 7.1 and all of the correct dependencies.



So if you don't require a specific version but just want the latest that works with the distribution drop the version number and use the command line above.






This is the correct answer

– rayzinnz
Jun 23 '18 at 7:04



On Ubuntu 18.04, I had to add the repository below first. Once the repo was added I was able to install the php7.x items.


sudo add-apt-repository ppa:ondrej/php



Source: https://websiteforstudents.com/apache2-with-php-7-1-support-on-ubuntu-18-04-lts-beta-server/



Apache server can't start because libapache2-mod-php7.0 is not installed:
by default aptitude or apt install php7.0-common version 7.8.13 which is not adaptable and libapache2-mod-php need 7.0.8



readline



install libapache2-mod-php7.0
RESTART APACHE 2
service apache2 restart



it must working probably
Good Luck!



Try for Ubuntu 16.04:


sudo apt-get update;
sudo apt-get install php7.0-fpm php7.0-mysql <other packages>;



for Ubuntu 14.04:


sudo apt-get update;
sudo apt-get install php5-mysql php5-mysql <other packages>;



It should be:



sudo apt-get install libapache2-mod-php7.0


sudo apt-get install libapache2-mod-php7.1



worked for me (16.04Ubuntu).






updated php version, sudo apt install php7.2-mysql php7.2-curl php7.2-json php7.2-cgi php7.2 libapache2-mod-php7.2

– jitendra kumar
Nov 15 '18 at 10:53




Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)