Search code examples
phpphp-5.3incompatibility

PHP 5.3 incompatible - <? and <?php . How to fix?


Possible Duplicate:
<? ?> tags not working in php 5.3.1

I am running Debian Lenny and the "official" PHP version is 5.2.? -- However, I've ran across many things that now require PHP 5.3. After some googling, I have found a site to help me force debian lenny to go to 5.3.

Now I know a lot of things will break with 5.3. I don't seem to have that problem with most of the things I use. However one major problem I have always had was that I used the shorthand method of starting php code with: <? instead of the <?php. This was never an issue in PHP 5.2.? because it accepted both.

However, in PHP 5.3.5.0 from dotdeb it seems like the php is required. I went through and replaced all <? with <?php and then replaced all <?phpphp with <?php. That seems to have taken care of any issues I had with my code, however the shortcut in third party code such as <?= does not work as <?php=. I also do not wish to run this replacement on every php file I use from here on out.

How can I get php 5.3.? to allow both the shortcut <? and <?= to be accepted and not require the php?


Solution

  • You need to enable short_open_tag in php.ini.

    See also: <? ?> tags not working in php 5.3.1