Possible Duplicate:
<? ?> tags not working in php 5.3.1
I usually use shorthand syntax
<?="hello";?>
instead of
<?php echo "hello";?>
I created a development server and installed same version of php but shorthand method doesn't work, why? how can I fix it?
I would ask this on the server site, but this is related to a php setting or something I believe.
I'm running linux fedora 14
You need to enable the short_open_tag option in the configuration file php.ini
(probably in /etc/
). As you have discovered, short tags are disabled by default.
Edit: and yes, as @Sebastian P points out, this has been asked before.
Find your php.ini file in the apache directory and change short_open_tag = On
You probably need to enable short tags, which is an ini setting as you supposed.
You should note that short tags are regarded by some as a bad idea (myself included). I know they are handy and thus tempting, but this question illustrates the reason why NOT to use them - what if you move your code and CANNOT enable them (for whatever reason)? The most portable code does not use short tags. If you need to turn them on to make old code work, then do what you have to do. If you're setting up a server to start a new project, leave 'em off!
Docs: http://www.php.net/manual/en/ini.core.php#ini.short-open-tag
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With