0

I just registered EC2 and copy over my project to the EC2 server, and then I notice one weird thing: some of the variable can not be printed

It is how it happened

<?php
$username = "John";
?>

<p>Name: <?=$username?>.</p>

The result is doesn't output username

Name: .

This method doesn't work in EC2, is there any configuration setting I need to change to make it work?

4
  • 1
    What php version are you running on EC2? Commented Oct 5, 2014 at 22:13
  • short tags .... stackoverflow.com/questions/200640/… Commented Oct 5, 2014 at 22:23
  • Yes, it is php version issue. I upgrade it to php 5.4 and it works now Commented Oct 5, 2014 at 22:58
  • 1
    or you could just stop using short tags Commented Oct 5, 2014 at 23:03

1 Answer 1

1

Thanks for the suggestion above, this is php version issue. only php 5.4 or higher version support short tags. it works after upgrading php version to 5.4.33

THanks

Sign up to request clarification or add additional context in comments.

2 Comments

still should not use short tags regardless of version
@Dagon The short echo tags <?= are generally excepted and enabled by default. However, any short open tag is discouraged.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.