+ Reply to Thread
Results 1 to 8 of 8

Thread: PHP Parse Syntax Error

  1. #1
    richm8026 is offline x10 Sophmore richm8026 is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    138

    PHP Parse Syntax Error

    This is the Error Message I am getting:

    Parse error: syntax error, unexpected $end in /home/rick8027/public_html/index.php on line 42

    Can anybody go here and tell me what I can do to fix this???\\

    www.x01hosting.com/index.html thanks for the help

    here's the stuff in my PHP file at the bottom of it

    I don't see anything about $end in there..

    <html>

    <head>

    <title> See Your Calcuation Results </title>

    </head>

    <body>

    <p> The Answer for the calculation is: <? echo "$result"; ?></p>

    </body>

    </html>


  2. #2
    quantum1's Avatar
    quantum1 is offline x10Hosting Member quantum1 is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    near Nashville, TN
    Posts
    68

    Re: PHP Parse Syntax Error

    I believe your

    <? echo "$result"; ?>

    should be

    <?php echo "$result"; ?>

  3. #3
    richm8026 is offline x10 Sophmore richm8026 is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    138

    Re: PHP Parse Syntax Error

    I'll let you know in 2 Minutes if I have figured out my error


  4. #4
    natsuki's Avatar
    natsuki is offline x10 Sophmore natsuki is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    112

    Re: PHP Parse Syntax Error

    The most common thing to know about errors especially parse errors is that:

    The error is either in the error line or above that and NEVER after.
    You should check what comes in before that line... it says line 42 so there must be 41 lines before that.
    Last edited by natsuki; 10-26-2008 at 10:50 AM.

  5. #5
    richm8026 is offline x10 Sophmore richm8026 is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    138

    Re: PHP Parse Syntax Error

    Thanks, I noticed what I did wrong, but now it doesn't go to the index.php file, it was supposed to be a basic Calculator, and you type in two numbers and it's supposed to reload into the php file displaying the results, all it does is goes back to the index.html file, any help with that?? I'm sure you can view the source, I know you can't view the PHP syntax using the browser....


  6. #6
    natsuki's Avatar
    natsuki is offline x10 Sophmore natsuki is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    112

    Re: PHP Parse Syntax Error

    There's no way to view a php file using the browser, just post it in.

  7. #7
    quantum1's Avatar
    quantum1 is offline x10Hosting Member quantum1 is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    near Nashville, TN
    Posts
    68

    Re: PHP Parse Syntax Error

    If you have index.html and index.php in the same directory, I believe if a visitor goes to your site and does not specify a file (www.blahblah.com as opposed to www.blahblah.com/index.php) then it will find the index.html first. The information below is from the cpanel getting started wizard in the Introduction to Web Hosting section:

    When someone views a directory in your public_html area, they will see the index page for that directory. When creating your index page, you should use one of the following names (the first one found will be shown if the visitor doesn't type in a specific page in their URL):
    index.htm
    index.html
    index.shtml
    index.xhtml
    index.wml
    index.perl
    index.pl
    index.plx
    index.ppl
    index.cgi
    index.jsp
    index.js
    index.jp
    index.php4
    index.php3
    index.php
    index.phtml
    default.htm
    default.html
    home.htm
    index.php5
    Default.html
    Default.htm
    home.html
    Two rules of development:
    1) Computers work for people; People do not work for computers
    2) Maintainability is all that matters.

  8. #8
    Jake's Avatar
    Jake is offline Developer Jake is an unknown quantity at this point
    Join Date
    Apr 2005
    Location
    Winona, MN
    Posts
    2,084

    Re: PHP Parse Syntax Error

    rename your index.html -> index_backup.html and make sure you sitll have the index.php in the directory. Go to the URL... if you get that error again, first off you dont need "" around <?php echo $result; ?> and please post the code on and around line 42.
    Jake Omann | Developer
    █ 888-X10-9668 - jake[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004
    Premium Hosting | VPS Services

+ Reply to Thread

Similar Threads

  1. MDB2 Syntax Error
    By corewerx in forum Programming Help
    Replies: 2
    Last Post: 12-28-2011, 01:34 PM
  2. Wordpress PHP Error
    By wolf693 in forum Free Hosting
    Replies: 2
    Last Post: 04-13-2008, 01:59 PM
  3. Register Parse Error
    By manson in forum Free Hosting
    Replies: 2
    Last Post: 12-05-2007, 07:26 AM
  4. require_once Error (PHP)
    By Jarryd in forum Free Hosting
    Replies: 3
    Last Post: 11-23-2007, 10:50 AM
  5. Parse error: syntax error, unexpected
    By Fr33z4r in forum Free Hosting
    Replies: 12
    Last Post: 11-04-2007, 06:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers