-1

Possible Duplicates:
Are PHP short tags acceptable to use?
How to enable PHP short tags?

I came across some PHP code that is being used on a site. The odd thing is the php code is enclosed like this:

<? ?>

not

<?php ?>

How can I get it to run on my server without the 'php' in there?

take care, lee

Community
  • 1
  • 1
Lee Loftiss
  • 3,035
  • 7
  • 45
  • 73

3 Answers3

3

The opening tag <? is known as the short tag. It is not recommended because it requires a certain setting to function on servers. Specifically, you need to enable short_open_tag in your php.ini file.

EdoDodo
  • 8,220
  • 3
  • 24
  • 30
  • As a high rep user of SO you should not answer questions which have been asked before, you should close them! – markus Aug 06 '11 at 12:24
  • Ah, whoops, I missed http://stackoverflow.com/questions/2185320/how-to-enable-php-short-tags which is the only duplicate I see. I did find http://stackoverflow.com/questions/200640/are-php-short-tags-acceptable-to-use but that seemed different in that it was asking whether it was OK to use them or not, not how to enable them. – EdoDodo Aug 06 '11 at 12:27
  • @markus What's wrong with answering and closing them? – middus Aug 06 '11 at 12:38
0

Configure your server to allow short_open_tags; see the documentation for details.

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
  • As a high rep user of SO you should not answer questions which have been asked before, you should close them! – markus Aug 06 '11 at 12:25
0

You can use <? ?> with short_open_tag turned on in php.ini.

Are PHP short tags acceptable to use?

Community
  • 1
  • 1
Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176