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?


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
  • I got several errors during the process, here's my full output: pastebin.com/2hmbC1Su
    – dukevin
    Mar 5 '11 at 20:41
  • i have my php7 installed and it's not showing up .php files (running) Jul 15 '17 at 10:30

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

  • Looking at the site you provided, I typed this: vps:~# sudo a2enmod php4 ERROR: Module php4 does not exist!
    – dukevin
    Mar 4 '11 at 22:45
  • @Kevin - php4 definitely won't exist, you installed php5. Mar 4 '11 at 22:49
  • I get the same error for php5 :/
    – dukevin
    Mar 4 '11 at 22:51
  • And regarding your edited post, it says directory not found, perhaps I don't even have apache installed?
    – dukevin
    Mar 4 '11 at 22:52
  • Ah, reinstalling just said they are at their newest version. Not sure why I don't have /etc/apache or /ect/init.d/apache2
    – dukevin
    Mar 4 '11 at 22:54

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.