PHP code only works when enclosed in short open tags

回眸只為那壹抹淺笑 提交于 2019-12-25 12:17:13

问题


I have a PHP file which was working fine until last tuesday, I last-edited it a month ago so I don't know what made it stop working.

I changed the file to just echo a string:

<?php
echo "5";
?>

but it returns:

Parse error: syntax error, unexpected '"5"' (T_CONSTANT_ENCAPSED_STRING) in file.php on line 1

Then just store a variable:

<?php
$var = 2+3;
?>

And it returns:

Parse error: syntax error, unexpected '$var' (T_VARIABLE) in file.php on line 1

There are no whitespaces, everything you see here is what I have on my file.

Changing the opening tag to the short one makes it work (I have short_open_tag set to true but I have no right to edit the php.ini file)

PHP Version: 5.6.30
System: Linux arubabusiness.it

I "solved" saving the script to another file but I want to know what happened to this file, it seems like something blacklisted this file or something similar because it is the only file which is not working. I would like to know if anybody else experienced this strange issue.

来源:https://stackoverflow.com/questions/42717211/php-code-only-works-when-enclosed-in-short-open-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!