Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using <? vs. <?PHP - Server setting in WAMP [closed]

Tags:

php

wamp

I've tried googling this but I can't find the setting. I have a production server that accepts <? as well as <?php but I'm trying to use the site in WAMP but it doesn't accept <? alone, it insists on using <?PHP. Is this something I can set in WAMP?

like image 264
Neph Avatar asked Sep 26 '12 14:09

Neph


2 Answers

In your php.ini change the short-open-tag to short_open_tag=On

short_open_tag boolean Tells PHP 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 ?>).

Note:

This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available.

like image 137
j08691 Avatar answered Sep 19 '22 06:09

j08691


If you are using WampServer you can also left click on the icon down at the bottom right on your windows task bar. Roll over PHP, the PHP Settings, and the 4th item is "short open tag" just click that and it will turn it on for you without having to modify any files.

like image 25
Pitchinnate Avatar answered Sep 20 '22 06:09

Pitchinnate