tags:

views:

126

answers:

4

Hi,

My Apache/PHP installation is making me use <?php ... ?> instead of <? ... ?>. Where is this found in the configuration file so that I don't need to do the former? I'm assuming it's in php.ini, but not sure what it would be called.

+1  A: 

The option is called short_open_tag.

too much php
+5  A: 

It's the short_open_tag configuration directive. http://php.net/manual/en/ini.core.php

Messa
Thanks, and yes I understand the portability thing - but I just redid my server and have tons of old stuff with those style tags. But going forward - good idea :)
John Smith
In that case it may be better to use a .htaccess file and set the short_open_tag for your legacy code, but keep your server correctly configured to ensure maximum portability for your code.
Ben Rowe
+4  A: 

It is defined in php.ini as short_open_tag.

Keep in mind however, for maximum portability, stick with <?php ... ?>. You have just proved to yourself how unreliable it is to rely on short tags being enabled. You wouldn't want to show the world your PHP source if it made its way onto a short tag disabled server would you?

I've also read, but can not confirm, that short tags will be removed in newer versions of PHP.

alex
+3  A: 

Definitely keep using <?php instead of <?, it's good practice and it makes your code more readily mobile for other projects and websites that may have short_open_tag enabled or disabled.

Dexter