1

I'm creating a PHP application within Heroku. The problem is Heroku doesn't understand some tags as PHP. For example, <?=$some_var?> is not recognized as PHP, but as pure HTML.

Do I have to configure something or use <?php echo $some_var ?>, for example, instead?

2 Answers 2

4

You need to turn on short opening tags for your app on Heroku. Create a file called "php.ini" in the root folder of your project and add the following to it:

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

1 Comment

Thanks for answering this without suggesting a workaround! I needed to change a different configuration option – which has no workaround – and this solution did the trick :)
3

These <?= opening tags are called "short opening tags", and their use is set the PHP configuration file.

It is generally not advised to use short tags for this very reason; there's no guarantee the server you'll deploy on will be configured to use them.

1 Comment

FYI, PHP short tags are default and always starting with PHP 5.4. See docs.php.net/manual/en/migration54.new-features.php.

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.