guarriman Posted March 26, 2008 Share Posted March 26, 2008 Hi. Just installed PHP5 on my server, and found out that some of my PHP scripts start with "<?" instead of "<?php", so my application is showing the PHP code. Is there any php.ini configuration to ignore this? I want to survive with this until I modify the code during this week. Thank you very much, -- Thomas Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/ Share on other sites More sharing options...
ansarka Posted March 26, 2008 Share Posted March 26, 2008 in php.ini you have enable the short tags Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501179 Share on other sites More sharing options...
guarriman Posted March 26, 2008 Author Share Posted March 26, 2008 Yep. In "php.ini": short_open_tag = On Thank you very much. I heard about it but I didn't remember the keywords to google it Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501183 Share on other sites More sharing options...
revraz Posted March 26, 2008 Share Posted March 26, 2008 Or even better, go through all your code and change it to <?php instead. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501246 Share on other sites More sharing options...
lordfrikk Posted March 26, 2008 Share Posted March 26, 2008 Or even better, go through all your code and change it to <?php instead. Yeah, I'd recommend that too, because in PHP6 short tag notation will be deprecated. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501270 Share on other sites More sharing options...
PFMaBiSmAd Posted March 26, 2008 Share Posted March 26, 2008 The only current change in php6 concerning short tags is that the <% option has been eliminated and there is discussion about flagging inconstant code that mixes short <? and full <?php opening php tags. [rant] Sadly, <? is currently still part of php6 (I suspect that the person who thought two ways of doing the same thing, where one way won't always work and one will always work, is probably still on the php.ini development committee.) [/rant] Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501311 Share on other sites More sharing options...
lordfrikk Posted March 26, 2008 Share Posted March 26, 2008 Thanks for clearing it up, I've obviously mistaken <% for <?. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501313 Share on other sites More sharing options...
accident Posted March 26, 2008 Share Posted March 26, 2008 Ok, maybe I am missing something, but why the hell would they remove short tags? Why do they care if I use <? vs <?php ???? If they remove short tags they are pretty damn stupid. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501461 Share on other sites More sharing options...
revraz Posted March 26, 2008 Share Posted March 26, 2008 A good reason to is because of XML. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501462 Share on other sites More sharing options...
accident Posted March 26, 2008 Share Posted March 26, 2008 So what, because some people use XML they remove it for everybody? I have never used XML once because I never had to. All our applications are database driven. It would break pretty much all of our scripts if they removed it. (although not really hard to make a regular expression to replace all short tags with long tags) I can see having the flag, which is fine, but if they remove it completely... I personally would think it is retarded. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501467 Share on other sites More sharing options...
PFMaBiSmAd Posted March 27, 2008 Share Posted March 27, 2008 If you go back and actually read what I wrote, carefully, you will discover that short open tags are currently part of php6. If they would make the php parser a little smarter (I have seen a hack that does), it would be able to tell that <?xml is not a short tag followed by the letters xml. But the truth remains, short open tags are a bad idea and result in code that is not portable between server configurations. Just look at how many posts there are on this forum - "I just changed servers and I am seeing my php code in my browser". The answer is always the same, write code that will always be parsed by using full <?php tags, because you won't necessarily be on a server where you can turn on short open tags. Php.net itself recommends against using them - ; NOTE: Using short tags should be avoided when developing applications or ; libraries that are meant for redistribution, or deployment on PHP ; servers which are not under your control, because short tags may not ; be supported on the target server. For portable, redistributable code, ; be sure not to use short tags. Quote Link to comment https://forums.phpfreaks.com/topic/97957-php5-how-to-ignore/#findComment-501781 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.