If I use Admin Tools to create a .htaccess file the site downloads the index.php file instead of serving it. What setting causes this, why does it occur, can it be fixed, and what are the implications of fixing it?
3 Answers
If your server downloads index.php instead of executing it, look in your .htaccess
file for directive similar to
AddHandler x-mapp-php5.5 .php
and comment it out (put #
at the begining of line).
That should resolve your problem.
-
Thanks, that was all of the advice I had, I believe this is correct. So is there a way to set the PHP version using .htaccess? It used to work.– EoinCommented Jun 2, 2017 at 16:29
-
Ah I thought the PHP version manager created a .htaccess file. Maybe that has changed.– EoinCommented Jun 3, 2017 at 15:02
An .htaccess file should be compatible with the server in order to work and to not create issues.
Admin Tools .htaccess maker mentions that there is no guarantee that the produced .htaccess will work at your server. There are so many possible server configurations and there is not necessarily a particular setting that may cause specific side-effects and certainly with the information given in your question it's hard to tell - as we don't know both what your .htaccess looks like and also how your server is configured.
Either build step by step your .htaccess to see what's causing your issues - or collaborate with your hosting provider on the issue.
-
Thanks, I'll report back if I find it. My server is Siteground, but to be honest I've had the same symptoms on other servers.– EoinCommented Jun 1, 2017 at 17:23
Changing the .htaccess file didn't help me, so I did the following:
- Access the cPanel
- Go to MultiPHP Manager
- Select your website and change the php version to any other.
- Check your website now (wait 30 sec), and it should be working.
- Select your website again, and change back to the php version you were using before.
- Check your website again (wait 30 sec), and it should be working.
-
MultiPHP Manager is a plugin that extends cPanel - it's not a standard thing that everyone will find on his server.– FFrewinCommented May 14, 2020 at 17:21