-3

I have a PHP website and the index page displays fine online, but my local copy running on my wamp server gives me a parser error "Parse error: syntax error, unexpected end of file in..."

My local PHP is the same as my production. 5.6

I looked at previously asked question PHP parse/syntax errors; and how to solve them? and it mentions nothing about end of file.

Here is my code:

<?php

include "Calls.php";
my_session_start();
$sessionid = @$_SESSION["id"];
ini_set ("display_errors", "1");
error_reporting(E_ALL);
ini_set('short_open_tag',true);
include "production.class.php";

include "emailFunctions.php";
$selection="";
$mat = "";

include "currentSeason.php";

//current production

$currProd = new Production($arrSeason[0]['logo'],$arrSeason[0]['odate'],$arrSeason[0]['cldate'],$arrSeason[0]['credits'],$arrSeason[0]['director'],$arrSeason[0]['synopsis'],$arrSeason[0]['characters'],$arrSeason[0]['cast'],$arrSeason[0]['actors'],$arrSeason[0]['photos'],$arrSeason[0]['crewPositions'],$arrSeason[0]['crewNames'],$arrSeason[0]['season'],$arrSeason[0]['shownum'],$arrSeason[0]['showname'],$arrEntireSeason[0]['auddate'],$arrEntireSeason[0]['Special'],$arrEntireSeason[0]['Rights'],$arrSeason[0]['rightsText'],$arrEntireSeason[0]['matinee'],$arrEntireSeason[0]['ticketform'],$arrEntireSeason[0]['Promotion'],$arrEntireSeason[0]['misc'],$arrEntireSeason[0]['Type']);
$curshow=$currProd->getshownumber();

$arrSize = $aS+$aaud+$aevents+$aalerts;

$Events = array();
for($x=0;$x<sizeof($arrSeason);$x++){
    $Events[$x][0] = "show";
    $Events[$x][1] = $arrSeason[$x]["showname"];
    $Events[$x][2] = $arrSeason[$x]["odate"];
    $Events[$x][3] = $arrSeason[$x]["cldate"];
    $Events[$x][4] = $arrSeason[$x]["director"];
    $Events[$x][5] = $arrSeason[$x]["credits"];
    $Events[$x][6] = $arrSeason[$x]["season"];
    $Events[$x][7] = "";
    $Events[$x][8] = "";
    $Events[$x][9] = "";
    $Events[$x][10] = $arrSeason[$x]["shownum"];
    $Events[$x][11] = $arrSeason[$x]["cast"];
    $Events[$x][12] = $arrSeason[$x]["Promotion"];

}

if($aaud>1){
    for($a1=0;$a1<sizeof($arrAudInfo);$a1++){
        $Events[$x][0] = "audition";
        $Events[$x][1] = $arrAudInfo[$a1]["showname"];
        $Events[$x][2] = $arrAudInfo[$a1]["auddate"];
        $Events[$x][3] = "";
        $Events[$x][4] = "";
        $Events[$x][5] = "";
        $Events[$x][6] = $arrAudInfo[$a1]["season"];
        $Events[$x][7] = $arrAudInfo[$a1]["when"];
        $Events[$x][8] = $arrAudInfo[$a1]["where"];
        $Events[$x][9] = $arrAudInfo[$a1]["matOnline"];
        $Events[$x][10] = $arrAudInfo[$a1]["shownum"];
        $Events[$x][11] = "";
        $Events[$x][12] = $arrAudInfo[$a1]["audID"];

        $x+=1;
    }

} 
if($aaud==1){

    $Events[$x][0] = "audition";

    $Events[$x][1] = $arrAudInfo[0]["showname"];
    $Events[$x][2] = $arrAudInfo[0]["auddate"];
    $Events[$x][3] = "";
    $Events[$x][4] = "";
    $Events[$x][5] = "";
    $Events[$x][6] = $arrAudInfo[0]["season"];
    $Events[$x][7] = $arrAudInfo[0]["when"];
    $Events[$x][8] = $arrAudInfo[0]["where"];
    $Events[$x][9] = "";
    $Events[$x][10] = $arrAudInfo[0]["shownum"];
    $Events[$x][11] = "";
    $Events[$x][12] = $arrAudInfo[0]["audID"];
    $x+=1;

}

if($aevents>1){
    for($a2=0;$a2<sizeof($arrEvents);$a2++){
        $Events[$x][0] = "event";
        $Events[$x][1] = $arrEvents[$a2]["Event"];
        $Events[$x][2] = $arrEvents[$a2]["eventDate"];
        $Events[$x][3] = "";
        $Events[$x][4] = "";
        $Events[$x][5] = "";
        $Events[$x][6] = "";
        $Events[$x][7] = "";
        $Events[$x][8] = $arrEvents[$a2]["where"];
        $Events[$x][9] = "";
        $Events[$x][10] = $arrEvents[$a2]["ID"];
        $Events[$x][11] = $arrEvents[$a2]["EventDetails"];
        $x+=1;
    }
} 
if($aevents == 1){
    $Events[$x][0] = "event";
    $Events[$x][1] = $arrEvents[0]["Event"];
    $Events[$x][2] = $arrEvents[0]["eventDate"];
    $Events[$x][3] = "";
    $Events[$x][4] = "";
    $Events[$x][5] = "";
    $Events[$x][6] = "";
    $Events[$x][7] = "";
    $Events[$x][8] = $arrEvents[0]["where"];
    $Events[$x][9] = "";
    $Events[$x][10] = $arrEvents[0]["ID"];
    $Events[$x][11] = $arrEvents[0]["EventDetails"];
}



if($aalerts == 1){
    $Events[$x][0] = "alert";
    $Events[$x][1] = $arrAlerts[0]["Alert"];
    $Events[$x][2] = $arrAlerts[0]["alertDate"];
    $Events[$x][3] = "";
    $Events[$x][4] = "";
    $Events[$x][5] = "";
    $Events[$x][6] = "";
    $Events[$x][7] = "";
    $Events[$x][8] = $arrAlerts[0]["where"];
    $Events[$x][9] = "";
    $Events[$x][10] = $arrAlerts[0]["ID"];
    $Events[$x][11] = $arrAlerts[0]["AlertDetails"];
}

//Sort events by date
array_sort_by_column($Events,2);


//register email
if(isset($_POST['emailSub'])){
    joinEmail($_POST['email']);
}

function array_sort_by_column(&$array, $column, $direction = SORT_ASC){
    $reference_array = array();

    foreach($array as $key => $row){
        $reference_array[$key] = $row[$column];
    }

    array_multisort($reference_array, $direction, $array);
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>The Little Theatre of Jefferson City</title>
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <link href="css/menu.css" rel="stylesheet" type="text/css" />
        <link rel="shortcut icon" href="images/favicon.ico" />
        <script src="scripts/plugins.js"></script>


        <script>

            function getCast(num,season){
                document.getElementById("showDetails").src = "cast.php?season=" + season + "&shownum=" + num;
            }
            function getAudInfo(num,season,aid){
                //alert(aid);
                document.getElementById("showDetails").src = "viewAudInfo.php?aid=" + aid + "&season=" + season + "&shownum=" + num;
            }
            function getEvent(num){
                //alert(num)
                document.getElementById("showDetails").src = "eventdetail.php?event=" + num;
            }
            function getAlert(num){
                //alert(num)
                document.getElementById("showDetails").src = "alertdetail.php?alert=" + num;
            }

            function getVideo(file,auto){
                document.getElementById('player2').src="video.php?video="+file+"&auto="+auto;
            }

        </script>
        <style type="text/css">
            #dhtmltooltip{
                font-size: 12px;
                position: absolute;
                width: 200px;
                border: 3px inset black;
                padding: 2px;
                background-color: lightyellow;
                visibility: hidden;
                z-index: 100;
                /*Remove below line to remove shadow. Below line should always appear last within this CSS*/
                filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
            }
        </style>
        <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

            ga('create', 'UA-39749769-1', 'tltjc.org');
            ga('send', 'pageview');

        </script>
    </head>

    <body>
        <div id="dhtmltooltip"></div>
        <script type="text/javascript">

            /***********************************************
            * Cool DHTML tooltip script- � Dynamic Drive DHTML code library (www.dynamicdrive.com)
            * This notice MUST stay intact for legal use
            * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
            ***********************************************/

            selectArray=new Array("Click on the Prison Brews logo to download a special promotion for Whorehouse ticket holders!")



            var offsetxpoint=-60 //Customize x offset of tooltip
            var offsetypoint=20 //Customize y offset of tooltip
            var ie=document.all
            var ns6=document.getElementById && !document.all
            var enabletip=false
            if (ie||ns6)
            var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

            function ietruebody(){
                return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
            }

            function ddrivetip(thetext, thecolor, thewidth){
                if (ns6||ie){
                    if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
                    if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
                    tipobj.innerHTML=selectArray[thetext]
                    enabletip=true
                    return false
                }
            }

            function positiontip(e){
                if (enabletip){
                    var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
                    var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
                    //Find out how close the mouse is to the corner of the window
                    var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
                    var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

                    var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

                    //if the horizontal distance isn't enough to accomodate the width of the context menu
                    if (rightedge<tipobj.offsetWidth)
                    //move the horizontal position of the menu to the left by it's width
                    tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
                    else if (curX<leftedge)
                    tipobj.style.left="5px"
                    else
                    //position the horizontal position of the menu where the mouse is positioned
                    tipobj.style.left=curX+offsetxpoint+"px"

                    //same concept with the vertical position
                    if (bottomedge<tipobj.offsetHeight)
                    tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
                    else
                    tipobj.style.top=curY+offsetypoint+"px"
                    tipobj.style.visibility="visible"
                }
            }

            function hideddrivetip(){
                if (ns6||ie){
                    enabletip=false
                    tipobj.style.visibility="hidden"
                    tipobj.style.left="-1000px"
                    tipobj.style.backgroundColor=''
                    tipobj.style.width=''
                }
            }

            document.onmousemove=positiontip

        </script>
        <div id="main">
            <div class="container">
                <div id="header">
                    <div id="logo">
                    </div>
                </div>
                <?php include "menu.php" ?> 
                <div id="block_collage" class="block_flash">
                    <script type="text/javascript">
                        if (pluginlist.indexOf("Flash")!=-1){
                            document.write ("<embed src='images\/collage.swf' wmode='transparent' quality='high' pluginspage='http:\/\/www.macromedia.com\/go\/getflashplayer' type='application\/x-shockwave-flash' width='938' height='264'><\/embed>");
                        }
                    </script>
                </div>

                <div id='SpecialAnnouncement' class="block">
                    <h2>Now Available</h2>
                    <h3>Purchase your memberships online</h3><br />
                    You can now purchase 2016-2017 Season Memberships at all levels right here on our website!  <a href="https://www.tltjc.org/memberships/products.php">Follow this link</a> to purchase your membership using your Visa, Mastercard or Discover.
                </div>
                <div id="leftpane">
                    <div id="block_featured" class="block">
                        <h2>Upcoming TLT Events</h2>

                        <?
                        for($zzz=0;$zzz<sizeof($Events);$zzz++){
                            ?>
                            <div class="event">

                                <? if($Events[$zzz][0]=="show"){?>
                                    <h4>
                                        <a href="seasons.php?shownum=<?=$Events[$zzz][10]?>&curs=<?= $Events[$zzz][6]?>">
                                            <?=switchThe($Events[$zzz][1])?>
                                        </a>
                                    </h4>
                                    <div class="showinfo">
                                        <? if(strpos($Events[$zzz][5],"by")==0){ echo "by"; }?> <?=switchThe($Events[$zzz][5])?><br/>
                                        directed by <?=$Events[$zzz][4]?><? if(strpos($Events[$zzz][1],"Whorehouse")>0){?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='TLT_PB_Promo.pdf' onMouseover="ddrivetip(0,'#efe1ac', 500)" onMouseout="hideddrivetip()" target="_blank"><img src="images/prisonbrews_logo.jpg" style="float:right" /></a><? } ?><br/>
                                        <? if(date("d",strtotime($Events[$zzz][2]))==01){?>
                                            Show dates: <?=date("M",strtotime($Events[$zzz][2])).", ".date("Y",strtotime($Events[$zzz][3]))?><br/>
                                            <? } else{?>
                                            Show dates: <?=date("M",strtotime($Events[$zzz][2]))." ".date("d",strtotime($Events[$zzz][2]))."-".date("d",strtotime($Events[$zzz][3])).", ".date("Y",strtotime($Events[$zzz][3]))?><br/>
                                            <? } ?>

                                    </div>
                                    <? } ?>
                                <? if($Events[$zzz][0]=="audition"){?>
                                    <h4><a href="#ci" onClick="getAudInfo(<?=$Events[$zzz][10]?>,'<?=$Events[$zzz][6]?>',<?=$Events[$zzz][12]?>)"><? echo "Auditions-".switchThe($Events[$zzz][1])?></a></h4>
                                    <div class="showinfo">
                                        When: <?=date("M",strtotime($Events[$zzz][2]))." ".date("d",strtotime($Events[$zzz][2])).", ".date("Y",strtotime($Events[$zzz][2]))." at ".$Events[$zzz][7]?><br/>
                                        Where: <?=$Events[$zzz][8]?>
                                    </div>
                                    <? } ?>
                                <? if($Events[$zzz][0]=="event"){?>
                                    <h4><a href="#ci" onclick="getEvent(<?=$Events[$zzz][10]?>)"><?=switchThe($Events[$zzz][1])?></a></h4>
                                    <div class="showinfo">
                                        When: <?=date("M",strtotime($Events[$zzz][2]))." ".date("d",strtotime($Events[$zzz][2])).", ".date("Y",strtotime($Events[$zzz][2]))?><br/>
                                        Where: <?=$Events[$zzz][8]?>
                                    </div>
                                    <? } ?>    
                                <? if($Events[$zzz][0]=="alert"){?>
                                    <h4 class="alertLink"><a href="#ci" onclick="getAlert(<?=$Events[$zzz][10]?>)"><?=switchThe($Events[$zzz][1])?></a></h4>
                                    <div class="showinfo">

                                        Where: <?=$Events[$zzz][8]?>
                                    </div>
                                    <? } ?>
                            </div><br/><br/>
                            <? } ?>

                    </div>


                    <div id="block_multimedia" class="block">
                        <div id="videoheader" class="sectionheader">
                            Multimedia
                        </div><br/><br/>
                        <!--<video controls style="margin-left:50px;">
                        <source src="images/Video/Jamie_Waier_WUD.webm" type="video/webm" />
                        </video>
                        <h2><em>Cast Interviews</em>('Wait Until Dark')</h2>-->

                        See video clips <a href="multimedia.php#videos">here!</a>
                    </div>

                </div>
                <div id="rightpane">
                    <div id="block_currentInfo" class="block"><a name="ci"></a>
                        <? if(($Events[0][0]=="audition")&&($Events[0][2]!="0000-00-00")){?>
                            <iframe src="viewAudInfo.php?aid=<?=$Events[0][12]?>&season=<?=$Events[0][6]?>&shownum=<?=$Events[0][10]?>" 
                            scrolling="yes" frameborder="0" id="showDetails" name="showDetails" height="665" width="99%" />
                            <? } else if($Events[0][0]=="event"){?>
                            <iframe src="eventdetail.php?event=<?=$Events[0][10]?>" 
                            scrolling="yes" frameborder="0" id="showDetails" name="showDetails" height="665" width="99%" />
                            <? } else if($Events[0][0]=="show"){?>
                            <iframe src="cast.php?season=<?=$Events[0][6]?>&shownum=<?=$Events[0][10]?>"
                            scrolling="yes" frameborder="0" id="showDetails" name="showDetails" height="665" width="98%">
                            <? } ?>

                        </iframe>

                    </div>
                    <div id="block_signup" class="block">
                        <div id="signupheader" class="sectionheader">
                            Stay Informed
                        </div>
                        How can you keep yourself informed of everything that TLT does, including audition announcements,
                        ticket sales, performance reviews and more?  There is more than one way!  Read more below:
                        <hr />
                        Join our email list.  When TLT makes a major announcement, we always send out an email about it.   
                        <?php if(isset($_COOKIE['emailadd'])){  ?>
                            <br /><strong>You are registered on our email list as: <br /><?=$_COOKIE['emailadd']?></strong>
                            <? } else{?>
                            Enter your email address to sign up for our email list:<span style="color:red;"><?=$errormsg?></span>
                            <form action="http://cwebsolutions.net/dada/mail.cgi" method="post" accept-charset="UTF-8" id="subscription_form">
                                Email: <input type="text" name="email" size="40"/>
                                <input type="submit" name="emailSub" value="Sign Up" />
                            </form>
                            <? }?>

                        <hr />
                        Social networking is hot!  Join our <a href='http://www.facebook.com/#/group.php?gid=55791655556&ref=ts' target='_blank'><img src='images/fb_icon.jpg' style='border:none;' />Facebook goup</a> and follow us on <a href='http://twitter.com/tltjc' target='_blank'><img src='images/Twitter-icon.png' style='border:none;' />Twitter</a>.  We update them often.
                        <hr />
                        Subscribe to our <a href='newsfeed.php'>RSS newsfeed</a>.  You'll be able to see all of our recent news as soon as it's posted.  
                    </div>


                </div>

                <? include "footer.php" ?>


            </div></div></body>
</html>

2 Answers2

1

Most probably the combined use of normal and short open tag at the end of your document. Specifically this line:

<?php if(isset($_COOKIE['emailadd'])){  ?>

This line is opened with a normal tag. But the end of the if statement is not:

<? }?>

This causes PHP to conclude the document is not complete at the last line because it is still expecting a close tag from that if.

Short open tags are disabled by default on new installations. Presumably one installation has it enabled, and the other has not. Either enable short open tags in php.ini or replace them with normal open tags. At least using the same tag consistently will cause a more regular behavior.

ontrack
  • 2,963
  • 2
  • 15
  • 14
0

Php codes will show errors because of too many things. Some of them may consider the version of PHP. If your PHP Program is latest PHP 5 or above, You must need to install that latest version of Wamp in your PC. Otherwise, it will show errors like this.

MUHSIN MOHAMED PC
  • 167
  • 1
  • 2
  • 17
  • 1
    I don't think "Parse error: syntax error, unexpected end of file in..." error be related to the version of php! – EhsanT Jan 01 '17 at 01:14