Symptoms
When attempting to view a PHP page in a web browser, the page will download instead of being displayed in the browser.
Cause
The most common cause of PHP pages downloading instead of displaying in the browser is an incorrect AddHandler or SetHandler value in the site's .htaccess file.
Resolution
The .htaccess file can be edited directly to correct the values, or it can be moved out of the way and replaced with a new .htaccess file.
To move the .htaccess file out of the way, rename the .htaccess file using cPanel / Files / File Manager or run the following command:
# mv -v /home/$USER/public_html/.htaccess{,.bak}
Note: Replace $USER with the actual cPanel username. If this is not for the primary domain of an account, ensure you also update the path of the .htaccess file to the correct path for the domain or subdomain you are experiencing this issue on.
To replace the .htaccess file:
- Navigate to the cPanel / Software / MultiPHP Manager interface.
- Select the domain that needs the new
.htaccessfile. - Select the correct PHP version for the site from the PHP Version drop-down menu.
- Click the "Apply" button.
Comments
0 comments
Article is closed for comments.