I met "PHP Parse error: syntax error, unexpected '{' in ..." error when I tried to execute PHP CLI script.
Error message:
PHP Parse error: syntax error, unexpected '{' in ??/test.php on line 9
Command:
php -f ./test.php
Code:
<?php
echo 'begin'.PHP_EOL;
try {
echo 'try!'.PHP_EOL;
} catch (Exception $e) {
echo 'exception'.PHP_EOL;
} finally{
echo 'finally'.PHP_EOL;
}
echo 'end';
PHP version: PHP 5.4.16 (cli) (built: Aug 5 2016 07:50:38)
Environment: RedHat 7.3
This is a strange case, this script work well at my Windows PC, but got this issue in Redhat machine.
Have someone once met this case as well?