When i access the url hosted on virtualmin download starts in centos 7

I have installed virtualmin on centOS 7. & created a virtual server.
But when I open the url it does’nt execute but a blank file starts downloading. I am stuck here
Anyone please guide me
I am using PHP 5.4.16

First off, php5.4 was end of life in 2018 and isn’t supported by anybody anymore, so you run your own risks using it.

Secondly, are you running a Wordpress install on that Virtual Server?

Have you tried using a different browser to open the site?

Have you tried the Preview Site option from the Services Menu in Virtualmin?

Thank You for the quick response. I have upgraded the php to 7.4. & I am not using wordpress. try to host simple php script. Yes I have a preview of website but same error there as well

After Upgrading the php version, the error is still there.

Did you restart your Apache server after the upgrade?

Did you apply php7.4 to the server in question?

Are you running an htacess file? If so try disabling it.

yes I restarted Apache server. & also applied php 7.4 to website. & also tried to disable htaccess file. but no success.

Can you post a link so I can see if I can see it?

www.mgelearning.net

I’m getting Forbidden error, so you do have issues. I went ahead and added the index.php to the address and downloaded it. You have this at the start of that file. What it’s doing is getting rid of everything and trying to set the environment right back to php5.3 is what it looks like.

I don’t know what you’re running, but it just looks to be very old and outdated. Is it just a website or some sort of application?

switch (ENVIRONMENT)
{
case ‘development’:
error_reporting(-1);
ini_set(‘display_errors’, 1);
break;

case 'testing':
case 'production':
	ini_set('display_errors', 0);
	if (version_compare(PHP_VERSION, '5.3', '>='))
	{
		error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
	}
	else
	{
		error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
	}
break;

default:
	header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
	echo 'The application environment is not set correctly.';
	exit(1); // EXIT_ERROR

can you please check the url again?
As now i have extracted the files & again it is giving download.

Now it’s downloading the file.

Go to Virtualmin / Server Configuration / PHP Options and see what settings you have in there. You should have it set on FCGId, Unlimited Run Time, Version 7.4. If it’s something other than that, set those up and hit save.

I have set all the values as above. then restarted apache & again the same error I get.
I am very thankful for your valuable time

Let’s try something simple.

Make a text file and name it hello.php

Then pasted this code into it:

<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'; ?> 
 </body>
</html>

Save it and upload it to your public_html directory on that virtual server. Then visit http://www.mgelearning.net/hello.php and see what happens.

One more thing, are you running Cloudflare? If so, make sure you empty the cache on it. If not, no worries.

I have uploaded the file you can access now via browser
http://www.mgelearning.net/hello.php

giving the same error.
& I am not using cloudflare.

And you’re not using an htaccess file, right? Wow. This is quite something. What did you migrate to Virtualmin from?

this is a quiz script. migrated from hostgator.

OK. I’m setting up a test server so I can upload that index file to see what happens.

this is the script i am using

& thank you

OK, at least I get an error when I visit it. I think it’s a combination of the index file itself and the way you’ve set up your Virtualmin.

https://test2.exposingwot.com/index.php

That’s my test server with your index.php on it.

So How can I solve this? As I am new