roacha Posted June 10, 2008 Share Posted June 10, 2008 Hey guys, I installed Apache 2.2 and PHP 5.26 today. I have followed all the steps I could find to integrate the two. I created the phpinfo page and I can pull it up with a browser without any problems. I was running a "beta page" with my previous hosting provider and everything worked great. I grabbed all the php files from this old system and ftpd it to my new system. When I try and hit the index.php page with a browser I get this: var launchdate=new cdLocalTime("cdcontainer", "server-php", 0, "'.$LAUNCH_TIME.'");launchdate.displaycountdown("days", formatresults);', $content); if($COUNTER_FORMAT == 2) $content = str_replace("{COUNTER}", "Dude is coming on $LAUNCH_MONTH $LAUNCH_DAY, $LAUNCH_YEAR", $content); if($COUNTER_FORMAT == 3) $content = str_replace("{COUNTER}", "$CUSTOM_TEXT", $content); $content = str_replace("{PATH}", $path, $content); $content = str_replace("{CURRENT_TIME}", date("F d, Y H:i:s", time()), $content); $content = str_replace("{LOGO_BACKGROUND_COLOR}", $LOGO_BACKGROUND_COLOR, $content); $footer = file_get_contents("templates/".$TEMPLATE_NAME."/footer.html"); $footer = str_replace("{SITE_NAME}", $SITE_NAME, $footer); if($CONTACT_US_PAGE==1) $footer = str_replace("{CONTACT_US}", 'Contact Us | ', $footer); else $footer = str_replace("{CONTACT_US}", "", $footer); $content = str_replace("{FOOTER}", $footer, $content); echo $content; ?> It looks like a syntax problem but I have not made any changes to this file. Any idea what might be wrong? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 10, 2008 Share Posted June 10, 2008 Rather than showing us what you get in the browser, show the actual content of the .php file. My guess is your are using short open tags <? instead of <?php Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/#findComment-562146 Share on other sites More sharing options...
roacha Posted June 10, 2008 Author Share Posted June 10, 2008 Here are the contents of index.php. This was working fine on another server and I have not changed anything. Thanks for any help. # more index.php <? //version 1.1 include "config.php"; $path = str_replace("index.php","",$_SERVER['PATH_INFO']); $content = file_get_contents("templates/".$TEMPLATE_NAME."/index.html"); $content = str_replace("{TEMPLATE_NAME}", $TEMPLATE_NAME, $content); $content = str_replace("{SITE_NAME}", $SITE_NAME, $content); //April 23, 2008 2:30:57 if($LAUNCH_MONTH == 1) $LAUNCH_MONTH="January"; if($LAUNCH_MONTH == 2) $LAUNCH_MONTH="February"; if($LAUNCH_MONTH == 3) $LAUNCH_MONTH="March"; if($LAUNCH_MONTH == 4) $LAUNCH_MONTH="April"; if($LAUNCH_MONTH == 5) $LAUNCH_MONTH="May"; if($LAUNCH_MONTH == 6) $LAUNCH_MONTH="June"; if($LAUNCH_MONTH == 7) $LAUNCH_MONTH="July"; if($LAUNCH_MONTH == $LAUNCH_MONTH="August"; if($LAUNCH_MONTH == 9) $LAUNCH_MONTH="September"; if($LAUNCH_MONTH == 10) $LAUNCH_MONTH="October"; if($LAUNCH_MONTH == 11) $LAUNCH_MONTH="November"; if($LAUNCH_MONTH == 12) $LAUNCH_MONTH="December"; $LAUNCH_TIME = "$LAUNCH_MONTH $LAUNCH_DAY, $LAUNCH_YEAR $LAUNCH_HOUR:$LAUNCH_MINUTE"; $content = str_replace("{LAUNCH_TIME}", $LAUNCH_TIME, $content); if($COUNTER_FORMAT == 1) $content = str_replace("{COUNTER}", '<script type="text/javascript">var launchdate=new cdLocal Time("cdcontainer", "server-php", 0, "'.$LAUNCH_TIME.'");launchdate.displaycountdown("days", formatresults);</ script>', $content); if($COUNTER_FORMAT == 2) $content = str_replace("{COUNTER}", "<span class=counter-text>Dude is coming on $LAUNCH_MONTH $LAUNCH_DAY, $LAUNCH_YEAR</span>", $content); if($COUNTER_FORMAT == 3) $content = str_replace("{COUNTER}", "<span class=counter-text>$CUSTOM_TEXT</span>", $content); $content = str_replace("{PATH}", $path, $content); $content = str_replace("{CURRENT_TIME}", date("F d, Y H:i:s", time()), $content); $content = str_replace("{LOGO_BACKGROUND_COLOR}", $LOGO_BACKGROUND_COLOR, $content); $footer = file_get_contents("templates/".$TEMPLATE_NAME."/footer.html"); $footer = str_replace("{SITE_NAME}", $SITE_NAME, $footer); if($CONTACT_US_PAGE==1) $footer = str_replace("{CONTACT_US}", '<a href="contact.php">Contact Us</a> | ', $f ooter); else $footer = str_replace("{CONTACT_US}", "", $footer); $content = str_replace("{FOOTER}", $footer, $content); echo $content; ?> Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/#findComment-562149 Share on other sites More sharing options...
PFMaBiSmAd Posted June 10, 2008 Share Posted June 10, 2008 php.net's recommendation is that code not use short open tags as it will result in code that does not get parsed when moving between servers with different setting - ; 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. Change any <? to <?php and any <?= to <?php echo Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/#findComment-562153 Share on other sites More sharing options...
roacha Posted June 10, 2008 Author Share Posted June 10, 2008 Thanks for the feedback, I purchased this from a beta page company and I am not good with php. So should it look like this? <?php //version 1.1 include "config.php"; $path = str_replace("index.php","",$_SERVER['PATH_INFO']); $content = file_get_contents("templates/".$TEMPLATE_NAME."/index.html"); $content = str_replace("{TEMPLATE_NAME}", $TEMPLATE_NAME, $content); $content = str_replace("{SITE_NAME}", $SITE_NAME, $content); //April 23, 2008 2:30:57 if($LAUNCH_MONTH == 1) $LAUNCH_MONTH="January"; if($LAUNCH_MONTH == 2) $LAUNCH_MONTH="February"; if($LAUNCH_MONTH == 3) $LAUNCH_MONTH="March"; if($LAUNCH_MONTH == 4) $LAUNCH_MONTH="April"; if($LAUNCH_MONTH == 5) $LAUNCH_MONTH="May"; if($LAUNCH_MONTH == 6) $LAUNCH_MONTH="June"; if($LAUNCH_MONTH == 7) $LAUNCH_MONTH="July"; if($LAUNCH_MONTH == Cool $LAUNCH_MONTH="August"; if($LAUNCH_MONTH == 9) $LAUNCH_MONTH="September"; if($LAUNCH_MONTH == 10) $LAUNCH_MONTH="October"; if($LAUNCH_MONTH == 11) $LAUNCH_MONTH="November"; if($LAUNCH_MONTH == 12) $LAUNCH_MONTH="December"; $LAUNCH_TIME = "$LAUNCH_MONTH $LAUNCH_DAY, $LAUNCH_YEAR $LAUNCH_HOUR:$LAUNCH_MINUTE"; $content = str_replace("{LAUNCH_TIME}", $LAUNCH_TIME, $content); if($COUNTER_FORMAT == 1) $content = str_replace("{COUNTER}", '<script type="text/javascript">var launchdate=new cdLocal Time("cdcontainer", "server-php", 0, "'.$LAUNCH_TIME.'");launchdate.displaycountdown("days", formatresults);</ script>', $content); if($COUNTER_FORMAT == 2) $content = str_replace("{COUNTER}", "<span class=counter-text>Dude is coming on $LAUNCH_MONTH $LAUNCH_DAY, $LAUNCH_YEAR</span>", $content); if($COUNTER_FORMAT == 3) $content = str_replace("{COUNTER}", "<span class=counter-text>$CUSTOM_TEXT</span>", $content); $content = str_replace("{PATH}", $path, $content); $content = str_replace("{CURRENT_TIME}", date("F d, Y H:i:s", time()), $content); $content = str_replace("{LOGO_BACKGROUND_COLOR}", $LOGO_BACKGROUND_COLOR, $content); $footer = file_get_contents("templates/".$TEMPLATE_NAME."/footer.html"); $footer = str_replace("{SITE_NAME}", $SITE_NAME, $footer); if($CONTACT_US_PAGE==1) $footer = str_replace("{CONTACT_US}", '<a href="contact.php">Contact Us[/url] | ', $f ooter); else $footer = str_replace("{CONTACT_US}", "", $footer); $content = str_replace("{FOOTER}", $footer, $content); echo $content; ?php> I also changed the config.php to match this but now I just get a blank page with a browser. Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/#findComment-562187 Share on other sites More sharing options...
wildteen88 Posted June 10, 2008 Share Posted June 10, 2008 Only the start tag should be <?php not the ending tags. Ending tags should be just ?> Correct syntax: <?php // your code here ?> The following is incorrect <?php ?php> Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/#findComment-562213 Share on other sites More sharing options...
roacha Posted June 10, 2008 Author Share Posted June 10, 2008 That was it!! Thanks guys.. Quote Link to comment https://forums.phpfreaks.com/topic/109596-solved-indexphp-not-working-while-phpinfo-works/#findComment-562223 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.