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

rmznatly's avatar

Uncaught (in promise) SyntaxError on Console

Hello. I'm in a very strange problem.

My project, which works fine on local, does not work properly on the live server.

Let's give a select componenet example, ->afterStateUpdated() containing.

It doesn't work when triggered and this error appears in the console.

Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0

When I look at the response results, PHP returns. In local json.

It seems to be the same problem everywhere related to livewire.

Why is this happening, I'm going crazy.

SS: https://ibb.co/mV8mf7cQ

0 likes
5 replies
tykus's avatar

It looks like you are getting back unprocessed PHP from the web server. You need to (i) confirm that you have PHP-FPM installed on the production server and (ii) properly configured the web server to pass PHP files to the PHP process.

rmznatly's avatar

@tykus Hello, Thank you for your response. The server I'm running really doesn't support PHP-FPM. I installed it myself according to the instructions but the result didn't change. Maybe I'm doing it wrong, I don't know, the company I rented the server from doesn't support this. Is there a place you can recommend me?

rmznatly's avatar

Hello, Thank you for your response. The server I'm running really doesn't support PHP-FPM. I installed it myself according to the instructions but the result didn't change. Maybe I'm doing it wrong, I don't know, the company I rented the server from doesn't support this. Is there a place you can recommend me?

tykus's avatar

@rmznatly "the company I rented the server from doesn't support this" - doesn't support PHP web applications or something else???

rmznatly's avatar

@tykus

the company did not help with the PHP-FPM installation. After your information, I saw that it was not really installed and I installed it myself. The problem was still there and I saw this;

The problem is very interesting. I started one of my service files with <? instead of <?php. While this does not cause problems on local, for some reason the server does not accept it. Solved.

Please or to participate in this conversation.