Below is the error while running the command:

root@mycompanyname:~# apt-get install apache2*
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package apache2.conf
E: Couldn't find any package by regex 'apache2.conf'


Wanted to update php5.3 (5.3 PHP = 7.43 INR) to php5.5 (5.5 PHP = 7.72 INR) to do this followed steps given here.

After this apache2 stopped detecting php itself.

After lot of troubleshooting we removed php and apache2 using below commands:

root@mycompanyname:~# apt-get purge apache2*
root@mycompanyname:~# apt-get purge php*
root@mycompanyname:~# apt-get autoremove
root@mycompanyname:~# apt-get autoclean
root@mycompanyname:~# apt-get clean
root@mycompanyname:~# apt-get remove
root@mycompanyname:~# apt-get purge
root@mycompanyname:~# apt-get install
root@mycompanyname:~# dpkg -a -configure

after all this we tried to reinstall apache2 and started getting that error:

Just for reference here is the sources.list file for apt.

We are not facing any issues while using below commands:

root@mycompanyname:~# apt-get update && apt-get upgrade

Please help! thanks in advance.

  • 1
    Try without the *. Or quote it: 'apache2*' – muru Feb 9 '15 at 10:32
 apt-get install apache2* 

Should just be

 apt-get install apache2

Apt will suggest some extra packages to install at that point. Read through them and decide if want/need, but I usually only install

 sudo apt-get install apache2 apache2-utils

Apache2 is working in my system so try follow this:

Please remove already you installed apache2 and php5.

Now try to a fresh installation.

You add source code to apt sources list.
gedit /etc/apt/sources.list to add following codes:

deb http://ppa.launchpad.net/ondrej/php5/ubuntu precise main           
deb-src http://ppa.launchpad.net/ondrej/php5/ubuntu precise main  

deb http://ppa.launchpad.net/ondrej/apache2/ubuntu precise main   
deb-src http://ppa.launchpad.net/ondrej/apache2/ubuntu precise main  

Save and update it.

sudo apt-get update  

To install apache, php5 and mysql also:

sudo apt-get install lamp-server 

After installed you get php5.5 and apache2.4 versions.

  • It would be better to do sudo add-apt-repository ppa:ondrej/apache2 and sudo add-apt-repository ppa:ondrej/php5 instead of manually editing sources.list. – muru Feb 9 '15 at 13:54
  • I try to add repository in terminal but its not added, thats only i suggested him to manually editing sources list. – shanmugam2138 Feb 9 '15 at 14:24
  • That might be some problem with your system, but it is not good advice in general. – muru Feb 9 '15 at 14:25
  • Every packages are loaded from source list then how to get problem ? – shanmugam2138 Feb 9 '15 at 14:30

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.