PHP code only works when enclosed in short open ta

2019-09-08 17:42发布

问题:

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.