scr34m/php-malware-scanner

Running on a shared Linux server from IONOS gives Parse error: syntax error

Closed this issue · 14 comments

When I tried to run this on a shared Linux server from IONOS I get an error saying:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /ROOTFOLDER/php-malware-scanner/scan.php on line 22

What is the version of the PHP?

8.0, I think.

I can't see any problem at line 22. and PHP version 8.0 should works, can you check what you see on line 22. ?

I'm just seeing private $ANSI_GREEN = "\033[32m";

Then try to remove the content from quotes, but this should be okay on any version of PHP.

Same error.

Okay i'll check it on a php 8.0

Well I assumed it was 8.0 because that is what IONOS shows for all the domains, however when I run php -v in PUTTY it shows 4.4.9.

I'm not sure what that would be different.

On 4.4.9 you can get this error maybe you have to call php8.0 or php7.4 or so for newer version.

Ok. Now when setting the PHP version I still get some errors.

With v7.4 I get this:
Parse error: syntax error, unexpected '033' (T_LNUMBER), expecting identifier (T_STRING) in /ROOTFOLDER/php-malware-scanner/scan.php on line 22

With v8.0 I get this:
Parse error: syntax error, unexpected token "\" in /ROOTFOLDER/php-malware-scanner/scan.php on line 22

Something strange in this system then, it's evaluation the "\033[32m" but doesn't need.

It's works on php 5.6, 7.0-7.4 because i tested.

Those last errors might have been because the quotes were still removed. After putting the quotes back and setting the version to 7.4 it seems to be scanning properly.

So all good and you can close this issue then?

Yes :)