I'm trying to install the LAMP stack on a server running Ubuntu 10.10.

Whenever I browser to a PHP file on the server, my browser will download it as a file named "download" (with no extension). I have php5 installed, I have libapache2-mod-php5, I have purged and reinstalled the packages many times, and nothing has helped.

What can I do? I can provide config files, system info, etc. if necessary.

  • I'm guessing you already tried the dumb things? – Ignacio Vazquez-Abrams Oct 20 '10 at 0:16
  • Yes, I have already. – Richard Oct 20 '10 at 0:28
  • 1
    @Ignacio_Vazquez-Abrams - "I'm guessing you already tried the dumb things?" - ... but everyone has a different definition of what is and isn't dumb ... – danlefree Oct 20 '10 at 4:19

First, consider removing any PHP application files under the web root (it's possible, though not likely, that the "download" thing is the intended action...)

A few troubleshooting steps:

  1. wget -S localhost - What do your Server headers indicate?
  2. sudo dpkg --list | grep php - Which PHP packages are installed?
  3. echo "<?php phpinfo(); ?>" > /var/www/index.php - Create a phpinfo call and test (restart and test if desired)
  4. sudo a2enmod php5 - should print "Module php5 already enabled" (restart and test if desired)
  5. sudo grep "mods-enabled" /etc/apache2/* should print: apache2.conf:Include /etc/apache2/mods-enabled/*.load and apache2.conf:Include /etc/apache2/mods-enabled/*.conf (if not, add these directives at the end of your apache2.conf file, then restart and test)
  6. sudo cat /etc/apache2/mods-enabled/php5.conf should include the line AddType application/x-httpd-php .php .phtml .php3 - if this directive is wrapped in an IfModule conditional, comment out the IfModule conditional for testing (restart and test)
  • Awesome troubleshooting list. – pjmorse Oct 21 '10 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy