scr34m / php-malware-scanner

Scans PHP files for malwares and known threats
GNU General Public License v3.0
556 stars 96 forks source link

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

Closed pixelstuff closed 1 year ago

pixelstuff commented 1 year ago

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

scr34m commented 1 year ago

What is the version of the PHP?

pixelstuff commented 1 year ago

8.0, I think.

scr34m commented 1 year ago

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. ?

pixelstuff commented 1 year ago

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

scr34m commented 1 year ago

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

pixelstuff commented 1 year ago

Same error.

scr34m commented 1 year ago

Okay i'll check it on a php 8.0

pixelstuff commented 1 year ago

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.

scr34m commented 1 year ago

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

pixelstuff commented 1 year ago

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

scr34m commented 1 year ago

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.

pixelstuff commented 1 year ago

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.

rvalitov commented 1 year ago

So all good and you can close this issue then?

scr34m commented 1 year ago

Yes :)