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

egraells's avatar

Authentication not working on shared hosting (Hostgator)

I deployed my first application to Hostgator, everything works fine except for authentication.

Credentials are validated correctly but then the function auth::check always fail to false.

Anyone experienced that problem?

Thanks, Esteve.

0 likes
9 replies
bashy's avatar

Something to do with sessions then. Check they're enabled and working in the PHP version.

egraells's avatar

Thansk Bashi, but after reading and googling a lot nothing appears to be wrong.

What I've tested is that when testing the login harcoded: Auth::login(User::find(1)); everything works fine.

But I do not know what I can get with this. Is something wrong with Hostgator? With Laravel source?

Any help appreciated.

bashy's avatar

Is your primary key for users table different from id?

You can set it with this if needed

protected $primaryKey = 'ID';
sasha8080's avatar

hmm,, if the manual login works well then the problem is session.

check server information using phpinfo() function.

==== index.php === <? echo phpinfo(); exit .....

and see what it says.

bashy's avatar

Do you have a cookie plugin on your browser so you can check sessions?

Looks like PHP has sessions enabled but it won't say if the directory is not writable etc.

egraells's avatar

@wiggerl3000 Server Log files are empty, my laravel log file does not show any relevant info.

@bashy I see files created on the folder /app/storage/sessions as expected. May be you mean other folders on the server?

bashy's avatar

Never mind, Laravel doesn't use native PHP sessions? Make sure that storage folder is fully writable from the web user (or 777 if you want to).

Other than that, I'm lost.

Please or to participate in this conversation.