Adam Silva
Adam Silva

Reputation: 1047

PHP Gettext Short Version of <?php not working

I'm trying to use gettext to have some internationalization on my companies website. To test the website, I'm using XAMPP. And since I never used gettext before, I'm following this tutorial:

I'm having problems right from the start. The tutorial is using the short version of <?php, which is <?. I can't use the short version, and everthing after that is a mess. Anybody know what kind of configurations I have to make so it can work?

Upvotes: 1

Views: 137

Answers (2)

Krishna38
Krishna38

Reputation: 735

You need to Set

short_open_tag=On

in php.ini

And restart your Apache server. For more details please check this short_open_tag

Upvotes: 1

Jite
Jite

Reputation: 5847

The PHP Documentation says:

PHP also allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).
-- Docs

Personally (and seems the docs feels the same) I would recommend you to not use the short tags, especially if you will be running the code on more than one machine (seeing not all machines have this active).

Since PHP 5.4 the <?= ?> tags are usable without any ini changes, but the <? should still require it.

I suggest using the full <?php ?> tags instead, for best compatibility.

Upvotes: 1

Related Questions