Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have VPS running Debian 5.0 (I think) and I would like to get it to run PHP files. I was told it needed to be configured with Apache. I tried entering the command apt-get install apache2 php5 libapache2-mod-php5. But there was no change. Console output: http://pastebin.com/sVMWq6mA

This is everything in my /etc/apache2/mods-enabled: http://img35.imageshack.us/img35/6474/modsb.jpg

My webserver can be accessed here: In my test.php file I have the code :


but instead of displaying the page, it tries to download it. How can I fix this?

share|improve this question
up vote 2 down vote accepted

I think you probably missed restarting apache2...

/etc/init.d/apache2 restart

You will have to run this command from your root account, or put sudo on the beginning of it.

For full details on installing PHP5 - use the official php5 on debian instructions HERE

share|improve this answer
:( sudo: service: command not found – Kevin Duke Mar 4 '11 at 22:43
lol - ok they are different in some respects - I'll modify my answer! – palbakulich Mar 4 '11 at 22:44
Looking at the site you provided, I typed this: vps:~# sudo a2enmod php4 ERROR: Module php4 does not exist! – Kevin Duke Mar 4 '11 at 22:45
@Kevin - php4 definitely won't exist, you installed php5. – palbakulich Mar 4 '11 at 22:49
I get the same error for php5 :/ – Kevin Duke Mar 4 '11 at 22:51

Run below commands again and check...

sudo /etc/init.d/apache2 stop
sudo apt-get remove --purge apache2 php5
sudo apt-get remove --purge libapache2-mod-php5
sudo apt-get install php5 apache2 libapache2-mod-php5
sudo /etc/init.d/apache2 start
sudo a2enmod php5
sudo /etc/init.d/apache2 force-reload
share|improve this answer
I got several errors during the process, here's my full output: pastebin.com/2hmbC1Su – Kevin Duke Mar 5 '11 at 20:41
This worked for me - thanks. – Banago Dec 1 '15 at 8:04

Your Answer


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.