Reputation: 229
I have a problem with WAMP server (2.1); I have some php files that contain php statements between
<? statements ?>
and the browser don't interprets the code. If I use :
<?php statements ?>
everything works ok.
Any idea how to fix it. Thank you.
Upvotes: 4
Views: 6111
Reputation: 5778
Whether you should or should not use short tags is debatable. I personally do not and I don’t recommend it. That being said — with WAMPServer 2 you can:
Using the tray icon (lower right — next to the clock) is the easiest, least error prone way to make any changes in WAMPServer 2+.
Upvotes: 7
Reputation: 41855
As kieran said:
This is a good thread on why you shouldn't use short tags: Are PHP short tags acceptable to use?
If you decided to used them, add in your php.ini:
short_open_tag=On
Documentation for php.ini directives
Be carefull, in a wamp installation, php.ini can be found at multiple locations:
wamp\bin\apache\Apache<version>\bin\php.ini
wamp\bin\php\php<version>\php.ini
Accessing the php.ini from the wamp menu (left click on wamp tray icon
/ php
/ php.ini
) opens the php.ini of the current apache version.
Upvotes: 2
Reputation: 2312
This is a good thread on why you shouldn't use short tags: Are PHP short tags acceptable to use?
Don't use <? statements ?>
- short tags are evil!
You can change it in the php.ini file but it even says in that file not to use them...
This directive determines whether or not PHP will recognize code between tags as PHP source which should be processed as such. It's been recommended for several years that you not use the short tag "short cut" and instead to use the full tag combination. With the wide spread use of XML and use of these tags by other languages, the server can become easily confused and end up parsing the wrong code in the wrong context. But because this short cut has been a feature for such a long time, it's currently still ; supported for backwards compatibility, but we recommend you don't use them. Default Value: On ; Development Value: Off ; Production Value: Off ; http://www.php.net/manual/en/ini.core.php#ini.short-open-tag
Upvotes: 1