Unexpected character and syntax error on wp-includes/formatting.php [closed]

If you are sure that you haven’t modified that file, this issue can be related to php version.

  1. What php version are you using in cPanel and AWS ?
  2. Have you tried switching to default wordpress themes ?

You can try upgrading/downgrading to the same php version you are using in cPanel and check if it works or not.

To be sure you can re-download the said file