Page display when upgrading to php 8.0

I just upgraded to PHP 8.0 and everything is working except when I send my output out of the server it is just showing up as text in the browser. It is a fully formed HTML page with html, head and body tags open and closing but the browser is interpreting it as text, not HTML. Same behavior in Chrome and Safari.

I use a series of echo constructs to create the page and that works fine in anything up to 7.x. Any idea why that same approach is not working in 8.0?

Thanks

Quick update, I just flipped the server back to PHP 7.0 and it is the same problem. So this is not an 8.0 issue it appears. But still an issue. And when I inspect the web page, all the code sent back shows up in the tags, so it is not recognized as a web page. Never seen this before.

That should say all the code sent back shows up in the body tags

Perhaps you could post some code, in case there’s something minor that you haven’t spotted. I often find a fresh pair of eyes solves all sorts of little problems.

I take it that it’s executing the PHP correctly, or is it showing that code too?

Here is the copy from the web page in Chrome:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login Page</title>
<script type="text/javascript">var xlon=644;</script>
<link rel="stylesheet" href="/bootstrap4-css/bootstrap.min.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->

			  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->

		      <!--[if lt IE 9]>

				  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>

				  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

				<![endif]-->
</head>
<body>
<div class="container">
<div id="sessletter" style="float:right;clear:right;color:red;font-size:1.5rem;font-weight: bold;">0</div>
<div class="row" id="msgajax"></div>
 
	
		<div class="row m-t-2">
			<div class="offset-xs-1 col-xs-22">
			<h1 class="pageheader text-center">Welcome to Our site</h1>
			</div>
			<div class="offset-xs-1 col-xs-22">
			<h2 class="pageheader text-center">
			Login Page</h2>
			</div>
		</div>

		<form class="form-inline" action="https://site.org/My_Account" method="post">

		<div class="row">
			<div class="offset-xs-1 col-xs-22 offset-md-2 col-md-21 col-lg-10">
				<div class="row rowseparator-1">
					<label>Username:</label>
					<input type="text" class="form-control form-control-sm input-sm-80 input-md-80 input-lg-70" placeholder="Enter Username" name="loguser" value="">
				</div>
			</div>
			<div class="offset-xs-1 col-xs-22 offset-md-2 col-md-21 offset-lg-1 col-lg-10">
				<div class="row rowseparator-1">
					<label>Password:</label>
					<input type="password" class="form-control form-control-sm input-sm-80 input-md-80 input-lg-70" placeholder="Enter Password" name="logpw" value="">
				</div>
			</div>
		</div>
<!--	<div class="row">
			<div class="form-group">
				<div class="col-md-6"></div>
				<div class="col-md-4">
					<label>Password:</label>
				</div>
				<div class="col-md-7">
					<input type="password" class="form-control" placeholder="Enter Password" name="logpw" value="bbriggs1">
				</div>
			</div>
		</div> -->
		<div class="row m-b-1">
			<div class="offset-xs-9 offset-lg-11">
			<button type="submit" class="btn btn-primary center-block">Sign In</button>
			</div>
		</div>
		<div class="row m-b-2">
			<div class="offset-xs-6 offset-md-7 offset-lg-10">
			<a href="/Reset_Login" rel="nofollow">I forgot my Username/Password</a>
			</div>
		</div>
		
		</form>

		<div class="row">
			<div class="col-xs-24 text-xs-center">
	All files <cite>copyrighted</cite> &copy by site; 2021-2021
			</div>
		</div>

		<div class="row m-b-3">
			<div class="col-xs-24">

			</div>
		</div>
</div>

		<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
		<script type="text/javascript" src="/js/bootstrap.min.js"></script>
		<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
		<script src="/js/General_All.js?v=17"></script>
		
</body>
</html>

What’s also interesting is that when I “inspect” the page in Chrome, all this text above shows in the body tags with a web page formed around it.

I posted this on the HTML forum also because I’m not sure if this is a php question or an HTML question. I have always output my web pages from the php server the same way and never had an issue and can continue to do so. It is this one site where the problem occurs.

Well, on the face of it I can’t see anything wrong with that. Maybe it’s a server configuration issue rather than a PHP or HTML one.

Well, for whatever reason, now it works. Suddenly. I would like to duplicate it but can’t at this point. I guess some things are just best left alone. lol Thanks for your time, it is appreciated.

3 Likes