webkidd Posted October 19, 2006 Share Posted October 19, 2006 I just started a new server. My old server had no problem if scripts had <? instead of <?php. Now my server will not parse them and the page comes up blank. What do I need to do?- Steve Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/ Share on other sites More sharing options...
sanfly Posted October 19, 2006 Share Posted October 19, 2006 Do you have access to the php.ini file?[url=http://php.net/ini.core]http://php.net/ini.core[/url] Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-111500 Share on other sites More sharing options...
BrandonK Posted October 19, 2006 Share Posted October 19, 2006 <? ?> is using short tags which can be disabled by default in newer versions of PHP. Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-111501 Share on other sites More sharing options...
webkidd Posted October 19, 2006 Author Share Posted October 19, 2006 Yes I can edit the php.ini.How do I turn it back on? Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-111547 Share on other sites More sharing options...
sanfly Posted October 19, 2006 Share Posted October 19, 2006 Firstly, always back up your php.ini file before you make any changesTry searching for short_open_tag and see what value it is set to (0 or 1). From the information in the link I gave you, I would assume that 0 is off and 1 is on? Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-111552 Share on other sites More sharing options...
Ninjakreborn Posted October 19, 2006 Share Posted October 19, 2006 It's best to alway's just code with <?phpLook throughout each page with search and replace.Or find and replace.<?with <?phpor just do it with php itself using str_replace()It's not good practice getting in that habit, as you can see, you will encounter problems. Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-111554 Share on other sites More sharing options...
Jenk Posted October 19, 2006 Share Posted October 19, 2006 Easier and future proof:open the file in notepad:ctrl+hreplace <?with <?phpctrl+hreplace: phpphpwith: phpIf it's loads of files.. won't be hard to write a small replace script:[code]<?phpfunction replaceTags($dir, $ext){ if (!$dir = realpath($dir)) return false; $hand = opendir($dir); while(($item = readdir($hand)) !== false) { $path = realpath($dir . DIRECTORY_SEPARATOR . $item); if (!in_array($item, array('.', '..'))) { if (!is_readable($path)) continue; if (is_dir($path)) { replaceTags($path, $ext); } elseif (strtolower(substr($path, -strlen($ext))) == strtolower($ext)) { $content = file_get_contents($content); $content = preg_replace( array('/<?\s{1}/', '/<?=/'), array('<?php ', '<?php echo '), $content ); file_put_contents($path, $content); } } } closedir($hand);}replaceTags('/var/www/doc_root', '.php');?>[/code]untested Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-111599 Share on other sites More sharing options...
webkidd Posted October 20, 2006 Author Share Posted October 20, 2006 Thanks. Link to comment https://forums.phpfreaks.com/topic/24474-problem-with/#findComment-112031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.