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?

migrated from webmasters.stackexchange.com Mar 4 '11 at 22:47

This question came from our site for pro webmasters.


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.

  • ERROR: Module php does not exist! – dukevin Mar 4 '11 at 23:06
  • 1
    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. – René Höhle Mar 4 '11 at 23:08
  • a2enmod php5 also says module does not exist. I'm using the root user for this. – dukevin Mar 5 '11 at 11:44
  • 1
    Ok another way go to /etc/apache2/mods-available is there a module called php? oder php5? @Kevin Duke – René Höhle Mar 5 '11 at 12:37
  • 2
    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 – René Höhle 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.

  • 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 – dukevin 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*/libphp5.so

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

  • command LoadModule not found :/ and what directory can I find the httpd.conf – dukevin 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/ – René Höhle Mar 5 '11 at 12:35
  • @Stony Do I put both of these in httpd.conf? Right now the file is blank. – dukevin Mar 6 '11 at 1:42
  • It still doesn't work by adding these – dukevin Mar 6 '11 at 2:50
  • 1
    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. – René Höhle Mar 7 '11 at 0:09

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.