php环境变化引起的”syntax error unexpected $end”

2014-04-08 00:00 阅读 341 次 评论关闭

今天修改php配置环境,将php.ini-develop 设为默认的php.ini,之后访问测试web的后台,报错:

Parse error: syntax error, unexpected $end in ……




报错的原因是:集成安装环境包默认的情况下不支持 PHP 短标签
解决办法:打开 php.ini ,找到 short_open_tag = Off 这一行,将 Off 修改为 On,保存退出,重启 Apache 就可以了。


In PHP 5, the following error may 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 configurations:
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 be broke up and distributed into multiple files, or into multiple PHP blocks, unless the break is within a method declaration.
But more commonly, the error is often caused by the use of Short Open tags in PHP, To use short open tags, it must be enabled in PHP.INI. Search for short_open_tag in PHP.INI, and change the value to On. The line should look line:
short_open_tag = On

转载请注明:php环境变化引起的”syntax error unexpected $end” | 猎微网