0

I tried:

sudo apt-get --purge remove php5-common
sudo apt-get install php5 phpmyadmin
sudo a2enmod php5
adding Servername localhost to /etc/apache2/conf.d/fqdn

Apache isn't recognizing php (instead prompting for download). How to make it correctly execute php?

James L
  • 6,025
  • 1
  • 22
  • 26
  • 1
    How do you know it is not recognizing PHP? What is the error message? – Khaled Nov 13 '10 at 12:53
  • The php info is intended to print / echo things, not prompt for download. – Delirium tremens Nov 13 '10 at 12:59
  • You need to isolate the problem further. What's in /etc/apache2/mods-available? The `sudo a2enmod` command requires as argument. Can you run PHP from the command line? `php -r 'echo "hello";'`. – James L Nov 13 '10 at 13:01
  • There are lots of things in mod-available. I had run sudo a2enmod php5, but wrote it wrong in the question. I can run php from command-line. – Delirium tremens Nov 13 '10 at 13:05
  • In mods-available, there are php5.conf, php5.load, php5filter.conf, php5filter.load. Is that what you wanted? – Delirium tremens Nov 13 '10 at 13:09
  • This and your [previous question](http://serverfault.com/questions/170375/download-prompt-instead-of-default-index-because-of-a-site-dir-name-change) on the same issue don't have enough detail. Look at your apache configuration, it probably enforces a separation of data and programs, with the latter in cgi-bin. – Tobu Nov 13 '10 at 13:12

3 Answers3

1

Missing AddHandler for .php?

3molo
  • 4,330
  • 5
  • 32
  • 46
0

Make sure you have the following in your configuration somewhere (it can be in the vhost definition or prior to it):
AddHandler php5-script .php

James L
  • 6,025
  • 1
  • 22
  • 26
0

install LAMP in Kubuntu with:

sudo apt-get install tasksel
sudo tasksel install lamp-server

restart Apache:

sudo /etc/init.d/apache2 restart

create phpinfo.php with:

<?php echo phpinfo(); ?>

place phpinfo.php in /var/www

clear browser cache

visit http://localhost/phpinfo.php

that should show the phpinfo