Click here to Skip to main content
16,022,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello everyone,

I have developed a project using Laravel, Vue.js 3, and Inertia. The project includes middleware for API, WEB, and AUTH. The application handles requests via API and allows users to log in and perform normal activities through web pages.

The issue:

The project works perfectly on my localhost. However, after deploying it on a shared hosting environment with cPanel, I encountered a session-related issue. When a user tries to log in via the login page (https://3nkaboot.com/login), they are redirected back to the same login page without any error messages, and they are not logged into the dashboard.

What I have tried:

Updated the .env file with the following settings:

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120


Modified the session.php configuration file:

<?php

use Illuminate\Support\Str;

return [

    'driver' => env('SESSION_DRIVER', 'file'),
    'lifetime' => env('SESSION_LIFETIME', 120),
    'expire_on_close' => false,
    'encrypt' => false,
    'files' => storage_path('framework/sessions'),
    'connection' => env('SESSION_CONNECTION'),
    'table' => 'sessions',
    'store' => env('SESSION_STORE'),
    'lottery' => [2, 100],
    'cookie' => env(
        'SESSION_COOKIE',
        Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
    ),
    'path' => '/',
    'domain' => env('SESSION_DOMAIN'),
    'secure' => env('SESSION_SECURE_COOKIE'),
    'http_only' => true,
    'same_site' => 'lax',
    'partitioned' => false,
];

Cleared the cache.

Despite these changes, the issue persists.


Has anyone encountered a similar issue when deploying Laravel projects with Vue.js 3 and Inertia on shared hosting?
Are there any additional configurations or settings that I might be missing for session management on shared hosting?
Could this be related to any specific settings on the cPanel environment?
Any help or guidance would be greatly appreciated.

Thank you!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900