PHP Parse error:syntax error, unexpected $end wrong solution

Source: Internet
Author: User
Tags apache error log parse error

Configure the server, when accessing PHP prompts PHP Parse error:syntax error, unexpected $end error, share my solution.

These days to write PHP program, feel a lot of places than asp,asp.net,jsp handy, such as session use first get Session_Start (), file jump header with not convenient ....

May be unfamiliar with some features of PHP, but write more, also slowly adapt to the will ...

Sort out a code-writing debugging problem with the following error: Parse error:syntax error, unexpected $end in D:\xampp\htdocs\guestBook\guestBook.php on line 330

Look at the program line 330, the last line of code, what's wrong with that? Google search, found: in PHP 5, the following error could appears as an error entry in Apache error log or simply displays on PHP web page, even if calling to PHP scripts with Php_info () works perfectly and successfully returns information on PHP Configur Ations:

Parse error:syntax Error, unexpected $end in ..... scripts.php on line ...

The error may caused to a missing curly bracket in PHP script coding. Beside, it may also caused by error in PHP coding in class definition, as in PHP, a class definition cannot is broke up an D distributed into multiple files, or to multiple PHP blocks, unless the break is within a method declaration.

But more commonly, the error was often caused by the use of the short Open tags in PHP,

To use the short open tags, it must is enabled in PHP. Ini. Search for Short_open_tag in PHP. INI, and change the value to on. The line should:

Short_open_tag = On

General Meaning: Error occurs when a short label is used and can be set in php.ini Short_open_tag = On

The original parse error hint is usually a syntax error, using an open tag, the statement is not the end of the programming basic errors, such as the end of the sentence without notice ";" or if () {...} after forgetting "}"; forget "?>". Check the code carefully, and sure enough is a missing "}", modify the program to run properly.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.