I build a website in xamp. use the tag <? … ?>. After that I m installed Wamp server, and paste the site in to it. but nothing is showing.
so i am changed the tag from <? … ?> to <?php … ?> its working. could you pls help?
short tag is not enabled in your php.ini file. so it was not working.
can we use like this to set ini configuration?
ini_set( “short_open_tag”, 1 );
There are other things that are legitimately found in a web page that conflict with the short tag version of the PHP tags - that’s why using the medium length versions of the tag <?php ?> is the way that is recommended to be used for maximum compatibility without needing all the typing of the long versions of the tags <script language=“php”> </script>
It is advisable to NOT turn short tags on as there are other uses for <? in a web page apart from as the start of a PHP tag. If you do turn it on you’d need to do so before starting to process the tags and so I would not expect that particular ini_set to work.
Short tags are officially deprecated in PHP 6 and so will soon no longer exist and so using them now is just making work for yourself in the future to get rid of them.
to enable the shorttag you need to change in the php.ini file of the wamp server to short_open_tag = On. you can search for the short tag and then set it to on.
Thank you dear…
From everything I’ve read about PHP, using short tags will only cause you headaches down the road.
Just my opinion, but if you are already typing <? ?>, what’s so hard about adding php to it?
I know this an old thread, but in case anybody reads it the above is not true.
There were rumors that short tags would be deprecated in PHP6, but they’re not. See http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html
<%, ASP style tags, will be deprecated in PHP6
That still doesn’t change the fact that you should avoid using short tags as <?xml is valid in web pages and so yor page can crash if you tell PHP to treat <? as if it were <?php because then you end up with the <?xml being treated as if it were <?phpxml which is garbage since XML is NOT PHP.
Also that article states that <% is being removed from PHP 6 - it is not just being deprecated since you can still use deprecated tags as they are not being actually deleted until the next version. What is deprecated in PHP 6 will be removed in PHP 7.