Probably the second most frequently posed problem on #httpd (after broken vhosts) is that of PHP scripts being offered for download in the browser.
The following steps should help to diagnose and fix the problem.
Flush the browser's cache
Delete the cache via the menus, restart the browser and try again. Even if this doesn't help immediately, remember to perform this step after each of the following.
Check if the proffered download contains untouched PHP code
Accept the download in your browser, open the saved file and see if it contains unparsed PHP code. If it does then your server isn't correctly configured for PHP.
To enable PHP, add the following to your apache config. Distro package users may want to consult the layouts page to find the relevant config file paths.
FIXME: Replace this with a dedicated page.
If the downloaded file has been parsed by the PHP engine, then go back to step one and flush your browser's cache. If that still doesn't work...
Check the Content-Type header
Using any of the methods documented in WatchingHttpHeaders, check the value of the Content-Type: http header.
application/x-httpd-php, you'll need to remove all erroneous references to that value as a mime type in your config. To do this, search your config file(s) for
AddType application/x-httpd-php and also remove all references to this 'type' from the
mime.types file. This is especially problematic for Debian/Ubuntu users whose configs contain multiple instances of this error.
text/plain, go back to step one. If it's anything else, it could be that your script is setting its own type header, or else no type is being set and httpd's
DefaultType value is being used.
PHP Configuration: engine Off
It is possible that PHP is explicitly disabled in your configuration, causing the PHP code to be sent to the http client as plain text, for example: