I just installed php 5.3.1 in my linux server and now my old work which i used to write with tags is not working at all..
Please help me out.. How can i resolve this??
I just installed php 5.3.1 in my linux server and now my old work which i used to write with tags is not working at all..
Please help me out.. How can i resolve this??
Looks like you got short_open_tags set to "Off" in your php.ini file. Try setting it to "On" and restart apache.
You most likely need to turn on short tags in your PHP configuration file. Without knowing your configuration, I couldn't say where you'd find it, but you're looking for php.ini (most likely somewhere like
/etc/php.ini
).In there, the setting you are after is
short_open_tags
. See here for all core configuration settings for PHP. However as others have mentioned, using short tags might not be the best strategy. Here is a good discussion of the reasons (for and against).If you use wamp or xamp, it's really easy to activate them. Just click on icon->php server->setting->allow short tag open
It's better to not use this functionality. For example xml use the same way to open header in docs.
To enable short tags, enable the
short_open_tag
ini directive in one of the following ways (most probably not all of them will work for you):short_open_tag = On
in your php.ini (the recommended way);ini_set("short_open_tag", 1);
in your code;add the following line to your .htaccess file:
php_value short_open_tag 1
More explanation:
It's not recommend you use short tags (
<? ?>
). You should use the full length tags (<?php ?>
). The short syntax is deprecated, and if you want to make your application portable, it's possible that short open tags are not allowed on another server and hence your application will break.On the other hand, the echo shorthand
<?= $var ?>
is enabled by default since PHP 5.4 regardless of php.ini settings and will not be deprecated. You can use it instead of<?php echo $var; ?>
And for the default behaviour:
And the reason of discouraging short open tags:
Note also this declined RFC about short open tags for templates: http://wiki.php.net/rfc/shortags
maybe your new configuration doesnt alllow short tags. Just use
<?php ?>
. It is better practise anyway.If you still want to use them you can
short_open_tag
directive. Also bear in mind that won't work if you have short tags disabled.The main reason for this is so you can use inline Xml tags.