dprnr5559 2013-05-12 15:28
浏览 54

第1行的意外T_STRING是否会导致服务器错误? [关闭]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

This is the start of my php document, and it throws up T_STRING errors with validation programs. I have tried viewing the document using XAMPP, and it worked fine, but when I uploaded the document to a server (this is for a class), I was given a server error. To make matters worse, this exact code is in all my other (working) php documents.
The code in its entirety is probably too long to post for a full diagnosis, so I wanted to know if this alone would cause the server error. If not this, what are some common causes?

Other things that seem suspicious:

$values = ["","","","","","",""];

I don't know if this is how a array should be created/cleared, but it was another error brought up with validation programs.

if (strlen($customerlname)>30) {
....
if (!is_numeric($postcode)) {

etc. These are supposed to be fine, though they don't seem to be recognised by N++.

The problem is that the document works with XAMPP, just not on the server. Is XAMPP just being nice and "knowing what I mean"? The only part that I can't test in XAMPP is the database connection:

$conn = mysql_connect("localhost", "XXXX", "XXXX");
mysql_select_db("XXXX", $conn)
or die ('Database not found '.mysql_error());  

which again, is in various other (working) documents. Is this probably going to be a server-side issue?

edit: I've found the apparent issue, thank you. The document is running now. The problem was the array, had to change a few instances to $variable = array(...); Thank you all for your help. It's also nice to know about phpinfo() for future reference.

  • 写回答

2条回答 默认 最新

  • douyong4623 2013-05-12 15:32
    关注

    If your document is starting at the top with:

    <?xml version="1.0" encoding="UTF-8"?>

    and if you have short_open_tag=On enabled in your webserver, PHP is assuming that by <? means, you are starting a PHP document, so, the xml after that is evaluating for a string.

    To check, if this is the case, then you should turn it off like: short_open_tag=Off and try loading your document again

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大