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

isbkch's avatar

"Class name must be a valid object or a string" php conf issue ?

I'm getting this error on my prod server when I call a method that uses belongsToMany():

FatalErrorException in Model.php line 936:
Class name must be a valid object or a string
in Model.php line 936

What I find strange is that the same code, shows no error on my local dev vagrant (both run on Debian, php 5.6.11, uses Laravel 5.1 and the same LAMP stack).

Is this could be related to some kind of php conf directive ?

0 likes
2 replies
isbkch's avatar

It's the same in both servers: 5.6.11 is it problematic ?

Please or to participate in this conversation.