X10nD
X10nD

Reputation: 22040

I want to make PHP work with <? ?> and not with <?php ?>

I have got 2 laptops with the same win7 configs. The Apache/PHP/MySQL are the copy/paste from one to the other. But the PHP works only if <?php ?> is added on one, and works fine with <? ?> on the other laptop.

I do not want to change the all PHP tags from <? ?> to <?php ?>. How do I make the PHP work with <? ?>.

Upvotes: 2

Views: 238

Answers (2)

user229044
user229044

Reputation: 239301

You need to enable short tags. Set short_open_tag to 1 in php.ini.

Prior to PHP 5.4, this enables both <? and <?= as alternatives to <?php and <?php echo respectively. In PHP 5.4, <?= is always on, so short_open_tag only controls the availability of <?.

Upvotes: 8

EboMike
EboMike

Reputation: 77752

Better idea: Change your code to use <?php. That way, it's more portable and you won't have to do the rewrite when you change servers.

If you really really want the shorthand and don't care about portability, change short_open_tag in your php.ini to 1.

Upvotes: 6

Related Questions