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?
-
3Instead of enabling short tags, **fix your scripts** to not use it. As you can see, short tags can be turned off which automatically turns your scripts into plain text files. Consequences are clear I think – Marcin Orlowski Sep 26 '12 at 14:34
-
1I'm not sure why this is being voted to be closed. It is a real question, and even if you disagree with short tags, you shouldn't close the question. – Vincent Savard Sep 26 '12 at 14:39
-
Duplicate of [How to enable PHP short tags?](http://stackoverflow.com/questions/2185320/how-to-enable-php-short-tags) (shame the close votes were already weighted towards "Not a real question"). – Quentin Sep 26 '12 at 14:42
6 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.

- 204,283
- 31
- 260
- 272
-
Sorry for the dupe, the shortag term slipped my mind. It's a site I'm working on, I don't use shorttags myself. – Neph Sep 26 '12 at 15:31
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.

- 7,517
- 1
- 20
- 37
PHP options are in the php.ini
file in your WAMP installation.
The setting you are looking for is short_open_tag = on

- 2,967
- 2
- 24
- 39
I think the question is truncated, anyway here's a tentative answer: By default php now enables only <?php
opening tag. To enable them, you should modify the php.ini file, located by default in C:/wamp/bin/php/php5.3.0, for WAMP (assuming you are using php 5.3.0).
If you have doubts locating your php.ini files check these instructions
There, you will find the "short_open_tag" setting, and you can set the value to "On". Beware that this is not recommended, for optimal compatibility in multiple environments Zend reccomends using only the long tag form <?php ?>
.
Remember to restart apache or any other webserver after modifying the php.ini files to get the new settings loaded.
In can get a long and very complete answer with references and defaults for various php versions in this stackoverflow thread
Its in the PHP.ini file
short_open_tag = Off
or short_open_tag = On
the On denotes your code can start with

- 17,474
- 4
- 36
- 51