guarriman Posted November 25, 2007 Share Posted November 25, 2007 Hi. I want to migrate from PHP4 (where I use '<?') to PHP5 (where I must use '<?php'). Do you know a program or a Linux script to do it? Thank you very much. Quote Link to comment Share on other sites More sharing options...
helraizer Posted November 25, 2007 Share Posted November 25, 2007 Hi. I want to migrate from PHP4 (where I use '<?') to PHP5 (where I must use '<?php'). Do you know a program or a Linux script to do it? Thank you very much. Why not just use a text editor like NotePad phpDesigner or any other and use Find & Replace? Find: <? Replace with: <?php Quote Link to comment Share on other sites More sharing options...
Agoniscool Posted November 25, 2007 Share Posted November 25, 2007 I highly recommend Notepad++. Great program, and it's free! Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 25, 2007 Share Posted November 25, 2007 Hi. I want to migrate from PHP4 (where I use '<?') to PHP5 (where I must use '<?php'). Do you know a program or a Linux script to do it? Thank you very much. PHP5 does support the short tags (<? and <?php=) all you need to do is enable a setting called short_open_tag. However if your script is small then I'd recommend you to convert the short tags to their respective full version. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Share Posted November 25, 2007 yes i would use <?php as php5 wants you to use it for a reason Quote Link to comment Share on other sites More sharing options...
trq Posted November 25, 2007 Share Posted November 25, 2007 Something like.... #!/bin/bash for file in $(ls -R htdocs/*.php) ; do sed -i -e 's/<?$/<?php/g' $file done would probably go close. Not tested. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 26, 2007 Share Posted November 26, 2007 Don't forget that <?= would need to be changed to <?php echo Quote Link to comment 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.