PHP 5.6 使用Nginx 和FastCGI 解析错误

PHP 5.6 parse error using Nginx and FastCGI

我正在使用 NGINX 和 PHP 5.6,升级后似乎无法调试此错误。我的错误日志显示为:

2015/12/29 11:57:56 [error] 928#0: 20485 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '}' in /var/www/magento/htdocs/pub/become/wp-content/themes/become/index.php on line 81" while reading response header from upstream, client: 83.110.226.45, server: sss.uat...com, request: "GET /become/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/sss.uat.*..com.sock:", host: sss.uat.***..com"

这是我的 PHP

<?
if($sss_article_featuretitle==""){?>
    <?php echo mb_strimwidth(the_title(), 0, 40, '...'); ?>
<?php } else { //line 81
    echo $sss_article_featuretitle;
}
?>

PHP 5.6 文档和一些搜索没有说明为什么这个查询没有过时。

删除所有多余的 open/close 标签:

<?php
if ($sss_article_featuretitle=="") {
    echo mb_strimwidth(the_title(), 0, 40, '...');
} else {
    echo $sss_article_featuretitle;
}
?>

更新: 尝试像这样更改它:

http://php.net/manual/en/language.basic-syntax.phpmode.php

<?php if ($sss_article_featuretitle==""): ?>
  <?php echo mb_strimwidth(the_title(), 0, 40, '...'); ?>
<?php else: ?>
  <?php  echo $sss_article_featuretitle; ?>
<?php endif; ?>

还要确保你不使用短的开放标签 <?,这不是一个好的做法,并且可能在 PHP 设置中被禁用,因此应该由 short_open_tag 指令在你的 php.ini 文件中。

http://php.net/manual/en/language.basic-syntax.phptags.php

检查您是否启用了 short_open_tags。看起来第一个 PHP 部分是 } else {。我认为它可能已在 PHP 5.6 中删除或至少已弃用。

你能在什么地方上传 phpinfo 吗?