Search code examples
phphomestead

Uncaught SyntaxError: Unexpected token '<' - Homestead


I have been working on somebody's web app which he uses Cakephp and laravel. The site was working very fine until I decided to re-establish homestead (I just re-extracted the zip file which includes the same homestead version and configurations). I am now encountering this issue "Uncaught SyntaxError: Unexpected token '<'" showing in the console when loading it to my browser. I believe that the problem is somewhere in my php.ini or some configuration regarding vagrant or my virtual machine since the site was working fine before and I didn't mess with the site files itself.

enter image description here

enter image description here

I am still new to these things, So can someone help me with that?


Solution

  • I figured it out. The problem was in php.ini in my vagrant machine. I have to set short_open_tag = On

    I use php7 --> the path to php.ini exists in /etc/php/7.2/fpm and /etc/php/7.2/cli

    I just added this short_open_tag = On at the bottom of each php.ini file and reloaded the vagrant machine with --provision tag and the problem gone.