Php prompts Parse error: syntax error, unexpected T_ENDWHILE in

Source: Internet
Author: User
Tags parse error

When writing a simple program, you will encounter the Parse error: syntax error, unexpected T_ENDWHILE in www. bKjia. c0m. php file. I will analyze the causes and solutions for you.

Symptom:

1. The same code runs normally on some machines, but an error is reported when running on specific machines.

2. Some pages of the same site are displayed normally (for example, <? Php phpinfo () ;?> ), However, when you open some pages, phpxx_errors.log or the page displays the error message "Parse error: syntax error, unexpected T_ENDWHILE in xx. php on line xx ".

Error cause:

This error may be caused by the loss of a curly braces ("}") when writing a PHP script, but the more common cause is that the short_open_tag value in the php. ini file is Off.

Determine whether to allow the abbreviated form of the PHP code start sign (<? ?> ). If you want to use PHP in combination with XML, you can disable this option for Embedded use. <? Xml?>. Otherwise, PHP can be used for output, for example: <? Php echo '<? Xml version = "1.0" ';?>. If disabled, you must use the complete form of the PHP code start flag (<? Php?> ).

Note: This command also affects the abbreviated form <? =, It matches <? Echo is equivalent. To use this abbreviation, set the short_open_tag value to On. Short tags are not recommended. <? Php?> It is the standard method, but this short label is used for a long time (for historical reasons). to be compatible with the old Code, this feature is saved.

Solution:

Set the short_open_tag value in the php. ini file to On.

Related Knowledge: PHP short label short_open_tag

Name Default Modifiable range Update log
Short_open_tag "1" PHP_INI_ALL PHP 4.0.0 is PHP_INI_ALL. PHP_INI_PERDIR is used in PHP <5.3.0.
Asp_tags "0" PHP_INI_PERDIR PHP 4.0.0 is PHP_INI_ALL.
Precision "14" PHP_INI_ALL  
Serialize_precision "17" PHP_INI_ALL Available from PHP 4.3.2. Before PHP 5.3.5, the default value is 100.
Y2k_compliance "1" PHP_INI_ALL Remove this option from PHP 5.4.0.
Allow_call_time_pass_reference "1" PHP_INI_PERDIR PHP 4.0.0 is PHP_INI_ALL. Remove this option from PHP 5.4.0.
Disable_functions "" Php. iniOnly Available from PHP 4.0.1.
Disable_classes "" Php. iniOnly Available from PHP 4.3.2.
Exit_on_timeout "" PHP_INI_ALL Available from PHP 5.3.0.
Expose_php "1" Php. iniOnly  
Zend. multibyte "0" PHP_INI_ALL Available from PHP 5.4.0
Zend. script_encoding NULL PHP_INI_ALL Available from PHP 5.4.0
Zend. signal_check "0" PHP_INI_SYSTEM Available from PHP 5.4.0
Zend. zemo-compatibility_mode "0" PHP_INI_ALL Available from PHP 5.0.0. Remove this option from PHP 5.3.0
Detect_unicode "1" PHP_INI_ALL Available from PHP 5.1.0. Outdated featuresSetWill beRemove.

 

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.