Josh Fradley
Josh Fradley

Reputation: 562

PHP code not executing on another user's server

Hi i had an issue reported for my script (https://github.com/joshf/Indication/issues/6) about echo statements printing rather than excecuting

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Indication</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="resources/bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
<style type="text/css">
body {
    padding-top: 60px;
}
</style>
<link href="resources/bootstrap/css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!-- Nav start -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Indication</a>
</div>
</div>
</div>
<!-- Nav end -->
<!-- Content start -->
<div class="container">
<div class="page-header">
<h1><? echo WEBSITE; ?></h1>
</div>      
<div class="alert alert-error"><h4 class="alert-heading">Error</h4><p>ID cannot be blank.</p><p><a class="btn btn-danger" href="javascript:history.go(-1)">Go Back</a></p></div></div></body></html>

Notice the echo WEBSITE

The PHP code is

  die("<div class=\"alert alert-error\"><h4 class=\"alert-heading\">Error</h4><p>ID does not exist.</p><p><a class=\"btn btn-danger\" href=\"javascript:history.go(-1)\">Go Back</a></p></div></div></body></html>");

! Is this a code issue or a configuration issue, im unable to reproduce it

Upvotes: 0

Views: 66

Answers (2)

Cito
Cito

Reputation: 1709

Probably you have turned off short tags in the server.

It is not a good idea to use

<? /* something */ ?>
<?=echo $something;?>

Because in some servers short tags are disabled.

Try:

<?php echo WEBSITE; ?>

Upvotes: 1

Fabio
Fabio

Reputation: 23500

This is probably because you are using php short tag <?..?>. Please avoid using them and switch to long one <?php....?>

Upvotes: 2

Related Questions