Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have previously had apache2 installed, I upgraded to php5.5 and this broke my install so i tried to fix a few files. But that didnt work, I autoremoved apache but I still get this error when I try to install:

/etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars
/etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars
ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
invoke-rc.d: initscript apache2, action "restart" failed.
share|improve this question

2 Answers 2

up vote 1 down vote accepted

When you remove and re-install Apache it does not remove or over write config files.

see How can I restore configuration files?

Try:

sudo apt-get purge apache2
sudo apt-get install apache2

If that fails, update your question with error messages

share|improve this answer
    
Do you mean sudo apt-get purge apache2 and sudo apt-get install apache2? (If so, that should work, though I'd suggest sudo apt-get --purge --reinstall install apache2, which does it in "one step" and, more importantly, makes sure any necessary package files are downloaded before performing the original package removal.) –  Eliah Kagan Sep 5 at 15:31

Try:

sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall apache2.2-common

It will reinstall apache packages and restore all configuration files in /etc/apache2.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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