How To Fix “WordPress Download File Instead Of Opening In Browser” [6 Methods]

Recently one of my friends encountered the issue with his blog that “WordPress download file instead of opening in browser” and there was no proper post on google on how to solve this issue.

If you are also having issues such as while opening your website, it’s downloading a file named download or index.php instead of opening your site then these fixes will resolve your issue.

So I am sharing all the possible methods, which are useful in solving this issue. 😁

WordPress Download File Instead of Opening In Browser

There are various reasons which can cause this issue. There are usually 2 main reasons behind this issue. Either you have a cache plugin that caused this issue or else you have some codes in your .htaccess file which may have caused this issue.

To fix this issue, we will follow 4 steps, which will help you to overcome this situation and you will be again able to use your blog without any kind of problem.

Solution for fixing WordPress Download File Instead of Opening Site

Just follow each of the steps carefully and your problem will be fixed in no time.

1. Update Your Server

If you are using a cloud or a VPS (Virtual Private Network), then you first need to update your system properly and then restart your server.

You need to log in to your server SSH using any terminal. If you are a Windows user then you can use Putty to login into your SSH. and for MAC users you can easily use your terminal to log in to SSH. Login to SSH as the root user or if you don’t have the root then you need to use sudo root to execute the given commands.

If you are using a Debian-based System such as Ubuntu then run the command given below.

apt-get -y update && apt-get -y upgrade

If you are on any Red Hat Enterprises System such as Centos then run the command given below.

yum -y update && yum -y upgrade

After executing the commands simply reboot your system and check if the problem persists or not.

To reboot your system type the command given below in any of the OS.

reboot

If you are not sure about the operating system of your system, you can run both of the commands to check which one works for you.

2. Uninstalled Any Cache Plugin

If updating your system, doesn’t helps you to solve your issue. Then you might need to check if you have any cache plugins installed in your WordPress.

If you are using any of the cache plugins such as WP Super Cache, WP Rocket, W3 Total Cache, etc then you need to deactivate them and then check if the issue exists or not.

The wordpress admin panel is usually accessible even after this issue, If your admin panel is also causing the same issue, then you need to remove the plugins manually from the file manager or from SSH.

If it solves your issue, then you need to check or ask in the forum of the respected plugin for the solution or you can try any other plugin for the cache.

If this still not solves your issue, then enable your cache plugin again and move to the next method.

3. Remove addHandler Code your .htaccess File

If you are on apache based server then you need to remove any addHandler code from your .htaccess file.

If you are having a panel to access your wordpress files, then edit your .htaccess directly or else you can use your SSH to edit directly.

Eg, of addHandler codes

  • AddHandler application/x-httpd-php4 .php
  • AddHandler application/x-httpd-php5 .php
  • AddHandler application/x-httpd-php51 .php
  • AddHandler application/x-httpd-php52 .php
  • AddHandler application/x-httpd-php53 .php
  • AddHandler application/x-httpd-php54 .php
  • AddHandler application/x-httpd-php55 .php
  • AddHandler application/x-httpd-php56 .php
  • AddHandler application/x-httpd-php7 .php
  • AddHandler application/x-httpd-php71 .php
  • AddHandler application/x-httpd-php72 .php
  • AddHandler application/x-httpd-php73 .php
  • AddHandler application/x-httpd-php74 .php

If you have any of these lines in your .htaccess file or any other resembling the above one, then you need to delete them from your .htaccess file and then check if your problem is solved or not.

4. Replace Complete .htaccess File

If your problem is not solved, then delete all the given codes in htaccess and replace it with the wordpress default htaccess file.

Copy and paste the WordPress Default htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] </IfModule>
# END WordPress

Save the file with the given code and check if your problem is solved or not.

If the problem is still there, then you might need to install wordpress from the scratch.

5. Reinstalling The WordPress

Reinstalling wordpress is the last step to solve this problem. This problem usually occurs at the frontend so you might be able to access the wordpress admin panel normally. If so, the case then takes the full backup using a backup plugin such as UpdraftPlus.

After successfully backup just delete everything and reinstall a fresh copy of wordpress and restore your backup from UpdraftPlus.

6. Seek Professional Help

So after trying every possible method, you are still unable to solve the issue then you need some professional help. You can reach out to us through the contact us page and our team will help you in resolving the issue quickly.

We have a team of experts who handles such issues on daily basis, so we will help you properly.

Conclusion

So if you are also here due to your WordPress PHP file is downloading instead of executing, then I hope you have found your solution. This issue is more common with WordPress due to various plugins.

This problem is due to a mismatch of the PHP version of your system with that mention in the .htaccess or due to some missing system updates.

This is easy to solve the issue in no time. If you don’t want to encounter such errors again, then always keep your system up to date and use only the official plugins for WordPress.

MyTechTalky is designed to introduce you with the best blogging tips and tricks currently available in the market and help you rank and optimize your blog.
All the information which is published on our website is collected through independent testing and research and the data is being verified through consultation with reliable sources.
We constantly update the content on our website, keeping it fresh and relevant to our readers at all times.

3 thoughts on “How To Fix “WordPress Download File Instead Of Opening In Browser” [6 Methods]”

Your email address will not be published. Required fields are marked with *.

  1. Thanks Sunny for your helpful article, I had same issue but the error happened because I installed AutoSSL without change the site and admin URLs in database (option table) or WordPress setting page in backend

    Reply
  2. Removed all plugins and themes and still getting the same problem,

    Interesting to hear Hazem using AutoSSL, I think I might be having the same issue

    Thanks,

    Reply
    • Hey Stephen,

      Sometimes some plugins also cause this issue due to incompatibility with other plugins or settings of your website. If nothing works for you I will suggest you take the backup of your wp-content folder and database and try reinstalling your wordpress from scratch & restore your backup, it will work 100%.

      Reply

Leave a Comment

Copy link
Powered by Social Snap