In your php.ini, set short_open_tag to On.
short_open_tag = On
From the docs:
short_open_tag boolean
Tells whether the short form (<? ?>
)
of PHP's open tag should be
allowed. If you want to use PHP in
combination with XML, you can disable
this option in order to use <?xml ?>
inline. Otherwise, you can print it
with PHP, for example: <?php echo
'<?xml version="1.0"'; ?>
. Also if
disabled, you must use the long form
of the PHP open tag (<?php ?>
).
Edit:
short_open_tag
is PHP_INI_ALL as of 5.3.0, which means that it can be changed anywhere (php.ini, .htaccess, in script). And it was PHP_INI_PERDIR before 5.3.0, which means that it can be set in php.ini and .htaccess. Therefore, you can change its value in most cases even if you don't control the server.
However, this setting is off by default. If you are going to distribute your script, it won't work on most installations out of the box. In this case, a search/replace to switch to <?php
is a good idea.