Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hcphoon01's avatar

PHP file read incorrectly

I have a laravel/homestead box that is running my laravel app and for some reason when a request is submitted to a php file that is part of a non laravel based api I get this error Uncaught SyntaxError: Unexpected token '<'. This error corresponds to the first line of the php file in question where it opens the file <?php.

I am working on this project with another developer and he does not get this error and he is using a global homestead installation rather than my 'per-project' installation.

I assume this has something to do with my environment but I am not sure what.

0 likes
4 replies
a4ashraf's avatar

Hi @hcphoon01

I suggest you that please check your homestead env,

if you share your code and file it would be great, meanwhile check your file extension it should be .php

hcphoon01's avatar

I've checked my homestead.yaml file and I cant see anything wrong with it. The php file in question is called from within a js file so I'm not sure if that could be part of the issue?

siangboon's avatar

possibly typo error.... if you cant find it then share the code let others to find for you...

hcphoon01's avatar

Its not an error in code at all, as I have said it works for the other developer perfectly fine

Please or to participate in this conversation.