PHP5 is installed, but Apache is displaying PHP as uninterpreted text. How to get it to process it as PHP

apache-2.2drupalphp5

In a Drupal installation, it's displaying the root PHP file as plain text below. a2enmod says that php5 is enabled, aptitude says libapache2-mod-php5 is installed, mods-enabled/ has php5.conf and php5.load, the VirtualHost has DirectoryIndex and ScriptHandler specified. It's kind of like the government economist computer virus: every indicator you can find says that your system is fine, but it doesn't work. What else should I do to get this Drupal 7 site in motion?

The page displayed is:

<?php

/**
 * @file
 * The PHP page that serves all page requests on a Drupal installation.
 *
 * The routines here dispatch control to the appropriate handler, which then
 * prints the appropriate page.
 *
 * All Drupal code is released under the GNU General Public License.
 * See COPYRIGHT.txt and LICENSE.txt.
 */

/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();

Best Answer

This sounds like apache is not configure properly to run php scripts

Check either of these files /etc/httpd/conf.d/php.conf or /etc/httpd/conf/httpd.conf for these two lines

AddHandler php5-script .php
AddType text/html .php

then restart apache

service httpd restart