Jump to content

[SOLVED] index.php not working while phpinfo works...


roacha

Recommended Posts

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

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 == 8) $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;

 

?>

 

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.