Problems with AMPPS displaying php code

I have AMPPS set up on my win10 laptop. I am placing .php files in my www folder. When opening the files in Firefox the pages display correctly if they contain plain HTML. But Chrome and Edge display the underlying code, complete with eg html and p etc tags.

And it gets more peculiar if I try and use php. In Chrome and Edge the underlying code is still displayed. But in Firefox the display is bizarre. Looking at the devtools inspector it seems to change the
tags to
and the next closing
that it comes across is changed to a
In other words it seems to be commenting out the PHP.

I am saving the files with a .PHP extension.

I have tried reinstalling AMPPS.

I am really puzzled by this and would welcome any help.

I will show an example page, in case I am doing anything dumb

<!DOCTYPE html>

<p>Hello HTML</p>
echo "Hello PHP";
//Try now
echo "<p>now</p>";

What URL are you entering in the browser address bar? It should be something like - http://localhost/your_file.php If it starts with c:\some_file_system_path…, that’s not a URL to the web server.

1 Like

Thank you so much. That was it! I was double clicking on the file in www and it was opening in the browser as file:///C:/Program%20Files/Ampps/www/index.php. Doing it the way you describe works. Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.