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

Source: Internet
Author: User
Tags apache error log class definition parse error php script
These days write PHP program, feel a lot of places than asp,asp.net,jsp conveniently, such as session use first get Session_Start (), file jump header use is also inconvenient ....

Maybe not familiar with some of the features of PHP, but write more, but also slowly adapt to the ...

Here is a code to write debugging problems, errors are as follows:

Parse error:syntax error, unexpected $end in D:\xampp\htdocs\guestBook\guestBook.php on line 330

Look at the 330 line of the program, the last line of code, what's wrong with that? Google search, found the:

In PHP 5, the following error may appears as a error entry in Apache error log or simply displays on PHP Web page, even I F calling to PHP scripts with Php_info () works perfectly and successfully returns on PHP information:

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

The error may caused by 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 D distributed into multiple files, or to multiple PHP blocks, unless the break was within a method declaration.

But more commonly, the ' error is ' often caused by the ' use of ' 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

Bullying my English is not good ah? Look at the other several search, did not mention the point, then look at English, although can not be translated, the general meaning is to see understand:

The error occurs when a short label is used and can be set Short_open_tag = on in php.ini

The original parse error prompts are generally grammatical errors, using the open tag, the statement is not the end of the basic programming is a number of errors, such as not paying attention to the statement end Plus ";" or if () {...} after forgetting "}" <?php ...? > Forgot "?>". Carefully check the code, sure enough is a missing "}", modify the program to run normally

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.