mnybud Posted October 30, 2008 Share Posted October 30, 2008 All my php scripts start with <? but I installed PHP locally and my php.ini requires my scripts to have <?php Is there a way to fix this without editing all my scripts? Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/ Share on other sites More sharing options...
realjumper Posted October 30, 2008 Share Posted October 30, 2008 Change the setting in php.ini Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678781 Share on other sites More sharing options...
mnybud Posted October 30, 2008 Author Share Posted October 30, 2008 yes but what setting do I change? I cant find it. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678857 Share on other sites More sharing options...
wildteen88 Posted October 30, 2008 Share Posted October 30, 2008 You should try to avoid using short tags (<? ?> <?= ?>) within your scripts. Short tags are depreciated and are not recommended. Hence why they are disabled by default. You should note they are soon to be removed completely as of PHP6. I would highly recommend you to convert your scripts to use the full PHP tags. However you can enabled them by setting the short_open_tag directive to On within your php.ini Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678859 Share on other sites More sharing options...
waynew Posted October 30, 2008 Share Posted October 30, 2008 <? tags are dirty. Ewww. Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678861 Share on other sites More sharing options...
PFMaBiSmAd Posted October 30, 2008 Share Posted October 30, 2008 If you do a search and replace of <?= to <? echo followed by a search and replace of <? to <?php your problem will be solved and your code will work on any server. Sooner or later you will end up on a server where you won't have the ability to turn on the setting. Php.net made a blunder when they created a second tag that defines where code starts and an even bigger blunder when that tag could be turned off. The tag that defines what code is should be unique and should always work. Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678865 Share on other sites More sharing options...
mnybud Posted October 30, 2008 Author Share Posted October 30, 2008 dirty or not it works now, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678868 Share on other sites More sharing options...
trq Posted October 30, 2008 Share Posted October 30, 2008 If you do a search and replace of <?= to <? echo followed by a search and replace of <? to <?php your problem will be solved And that could be done to every file ending with the extension .php on a Linux machine using.... find . -name '*.php' -exec sed -e 's/<?=/<? echo/g' -e 's/<?/<?php/g' {} \; edit: eww, that broke the tags. Quote Link to comment https://forums.phpfreaks.com/topic/130789-solved-local-php-issues/#findComment-678873 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.