sholtzrevtek Posted February 9, 2008 Share Posted February 9, 2008 I just installed php on my server and I could get the test.php page to work(yippey!) but the rest of my scripts would fail. I could not figure it out until I noticed the only difference between the test.php and the rest was the start of the php script. The non working scripts would start with "<?" and the test.php(working) uses "<?php". So, I added the "php" to the scripts and they worked! Is this normal? Most of my downloaded scripts use "<?" so obviously, it's not a problem for most people. If this is not normal, how could I fix it to accept the standard "<?" specs: Apache/1.3.33 (Darwin) PHP/5.2.4 Quote Link to comment https://forums.phpfreaks.com/topic/90179--/ Share on other sites More sharing options...
trq Posted February 9, 2008 Share Posted February 9, 2008 You can change the enable_short_opening_tags directive in your php.ini. It is however, best practice to code using the proper <?php tags. Quote Link to comment https://forums.phpfreaks.com/topic/90179--/#findComment-462415 Share on other sites More sharing options...
PFMaBiSmAd Posted February 9, 2008 Share Posted February 9, 2008 <? is not standard. It is a lazy way short cut that results in non-portable code. php.net recommends that any code that is to be distributed does not use short open tags - ; 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. All the other php configuration settings are detectable by code at runtime and can be dealt with if your code relies on them, but if your code uses short open tags <?, your code won't run and a lot of people either cannot or won't have the ability to turn short open tags on. Quote Link to comment https://forums.phpfreaks.com/topic/90179--/#findComment-462420 Share on other sites More sharing options...
sholtzrevtek Posted February 9, 2008 Author Share Posted February 9, 2008 <? is not standard. It is a lazy way short cut that results in non-portable code. php.net recommends that any code that is to be distributed does not use short open tags - ; 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. All the other php configuration settings are detectable by code at runtime and can be dealt with if your code relies on them, but if your code uses short open tags <?, your code won't run and a lot of people either cannot or won't have the ability to turn short open tags on. I am not a php programmer so I simply assumed it was standard since 99.9% of my "php resource" scripts start with "<?" including some I paid for. I am now in the process of fixing every tag. Thanks guys for helping me with this problem. Quote Link to comment https://forums.phpfreaks.com/topic/90179--/#findComment-462438 Share on other sites More sharing options...
vishal99 Posted February 9, 2008 Share Posted February 9, 2008 Hi, If you want quickly convert your short tage <? to <?php then go for for php tools. Php software, quickly optimize your code and easily fix your problems. Its also saves your lots of time. short php tags are not accpeted by some web hosts, so make sure. Thanks, Vishal Quote Link to comment https://forums.phpfreaks.com/topic/90179--/#findComment-462508 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.