解析错误:语法错误,带index.php的意外T_STRING?

时间:2010-05-12 15:39:07

标签: php indexing

它在本地主机中运行良好,但是当我将其上传到服务器时,它会出现以下错误:

Parse error: syntax error, unexpected T_STRING in D:\Hosting\4923367\html\beta\index.php on line 4

的index.php:

<?php
include_once 'localization.php';
?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!--Start Kampyle Exit-Popup Code-->
<script type="text/javascript">
var k_push_vars = {
    "view_percentage": 10,
    "popup_font_color": "#000000",
    "popup_background": "#D4E2F0",
    "header": "Your feedback is important to us!",
    "question": "Would you be willing to give us a short (1 minute) feedback?",
    "footer": "Thank you for helping us improve our website",
    "yes": "Yes",
    "no": "No",
    "text_direction": "ltr",
    "images_dir": "http://cf.kampyle.com/",
    "yes_background": "#76AC78",
    "no_background": "#8D9B86",
    "site_code": 9662374
}
</script>
<script type="text/javascript" src="http://cf.kampyle.com/k_push.js"></script>
<!--End Kampyle Exit-Popup Code-->

<!-- Start Kampyle Css -->
<link rel="stylesheet" type="text/css" media="screen" href="http://cf.kampyle.com/k_button.css" />
<!-- End Kampyle Css -->

(继续)

4 个答案:

答案 0 :(得分:13)

<?xml被误认为PHP短标记,尝试回应它(虽然我认为不需要它)

答案 1 :(得分:4)

问题似乎是各自服务器上php.ini文件中的设置存在冲突。尝试编辑服务器上的php.ini文件并设置

short_open_tag = 0

有关php.ini文件中可用指令的更多信息,请访问: http://php.net/manual/en/ini.core.php

答案 2 :(得分:1)

替换此

<?php
include_once 'localization.php';
?>
<?xml version="1.0" encoding="UTF-8"?>

用这个:

<?php
include_once 'localization.php';
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

答案 3 :(得分:0)

如果您只能访问nginx站点配置,只需将以下字符串添加到您的站点配置文件中(在php部分中):

  

fastcgi_param PHP_ADMIN_VALUE short_open_tag = 0;

然后重新启动nginx。