Welcome Guest!

Apache downloading PHP files instead of executing and serving web pages

Have you ever opened a web page on your website, and the page either attempts to download a .php file or it displays the PHP code in the browser? This is bad on multiple levels. First off, your website isn’t functioning properly; even worse is the idea that someone could get a first-hand glimpse of your code, which is not only a frustration, but a possible security issue. This issue can be solved by upgrading your PHP version and adding Apache Handers to serve your PHP files as needed.

This issue has recently been common on many websites running a deprecated version of PHP. Recently, PHP version 7.1 got obsolete and now it is advisable to upgrade to atleast PHP version 7.2 for better performance and security.


MultiPHP tool in your cPanel enables you to switch between multiple versions of PHP on your server at the same time. To do this, follow these steps:

  • Log in to cPanel
  • In the SOFTWARE section of the cPanel home screen, click MultiPHP Manager:
Click on the MultiPHP Manager
  • Under System PHP Version, cPanel displays the default PHP version for your server. Any domain that does not have a PHP version explicitly set uses this version.
  • To change the PHP version for a domain, under Set PHP Version per Domain, select the check box next to the domain for which you want to change the PHP version:
  • In the PHP Version list box, select the PHP version you want to use for the domain, and then click Apply:
  • The new PHP version for the domain takes effect immediately.


Apache is the service that processes and serves the files for your website to its visitors. The Apache handlers control what action should Apache take when it processes a particular file type. This means that you could use a handler to instruct the service to process files with certain extensions as a specific file type. For example, you can create a handler to instruct Apache to process files with .php extensions as php scripts. See more examples of Apache Handlers here. This is useful when you are using extensions for the files of your website that are not defined how to be handled by Apache, or when you want to use custom file extensions and need to ensure they are processed correctly.

In cPanel, you can use the Apache Handlers tool to add Apache Handlers:

Apache Handlers Tool under the ‘Advanced’ section

Add the following handlers by typing in the type and the extension:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Watch Video below for an idea how to do it:

Alternatively, to create a custom Apache handler you can add the following line in a file named .htaccess located where the files for your website are located (under public_html). In cPanel, be sure to enable display of hidden files to see it.

AddHandler handler .extension

Latest Posts

Apache downloading PHP files instead of executing and serving web pages

By / Jun, 23

How to get a Free Domain Name

By / Nov, 7

Choosing a Website theme

By / Aug, 1

Follow us on Twitter
Copyright 2020 | eZone Web Services
%d bloggers like this: