Server Fault is a question and answer site for system and network administrators. 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:

This is everything in my /etc/apache2/mods-enabled:

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

migrated from Mar 4 '11 at 22:47

This question came from our site for pro webmasters.

up vote 3 down vote accepted

Have you tried "a2enmod php" or "a2enmod php5" on your console to enable the php module?

Your command line is correct and it seems that everything is installed correct.

Edit: I have looked its

a2enmod php5
apache2ctl restart

Edit2: Ok i have looked on the server for the problem. There were different problems with the apt-get installer. Then were httpd running on port 80 so apache2 could'nt start on the port and the test.php file was not in a correct file encoding this was the main problem. After checking all of them and create a new file with vi it was running.

share|improve this answer
ERROR: Module php does not exist! – Kevin Duke Mar 4 '11 at 23:06
And have you tried "php5" ? Edit: With witch user do you try this? And you can look to the mods-available folder. There are all available modules and you can look for the name. – Stony Mar 4 '11 at 23:08
a2enmod php5 also says module does not exist. I'm using the root user for this. – Kevin Duke Mar 5 '11 at 11:44
Ok another way go to /etc/apache2/mods-available is there a module called php? oder php5? @Kevin Duke – Stony Mar 5 '11 at 12:37
I have installed before a few minutes a the same problem. But i have made a new apt-get install php5 and then restart the apache with apache2ctl restart. Then it was working. And under mods-avalable must be an mod php5.conf and php5.load – Stony Mar 5 '11 at 17:40

Try this:

apt-get install libapache2-mod-php5
apache2ctl graceful

EDIT: some explaining

Installing just the php5 package does not give Apache any modules. Installing the libapache2-mod-php5 package installs the php5 module to Apache and should enable it by default.

share|improve this answer
vps:~# apache2ctl graceful httpd not running, trying to start (98)Address already in use: make_sock: could not bind to address no listening sockets available, shutting down Unable to open logs – Kevin Duke Mar 6 '11 at 22:52

Check your httpd.conf file and ensure you have a line like this:

AddType application/x-httpd-php .php

Also ensure that you have loaded your php module:

LoadModule php5_module *path to your php module*/

This is the way I have configured it on my web servers.

share|improve this answer
command LoadModule not found :/ and what directory can I find the httpd.conf – Kevin Duke Mar 5 '11 at 11:45
LoadModule is not a command. You have to write this into your httpd. config in debian this should be under /etc/apache2/ – Stony Mar 5 '11 at 12:35
@Stony Do I put both of these in httpd.conf? Right now the file is blank. – Kevin Duke Mar 6 '11 at 1:42
It still doesn't work by adding these – Kevin Duke Mar 6 '11 at 2:50
When you install php5 over the apt-get function he load automaticly the php module. When you write this in your canfig you should look to your errorlog if the module is loaded 2 times. – Stony Mar 7 '11 at 0:09

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.