skip to Main Content

Help I got this problem when uploading my first laravel project to cpanel, can anyone help me. I’ve tried clear cache but it did not work

The error code is:

IlluminateFoundationBootstrapHandleExceptions::handleError vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:185

and the other error code hinted is:

ErrorException file_put_contents(C:Usersmy_userDesktopmy_project
namestorageframework/sessions/DpZjS9gGbWcX1jfqlu4btBLD02ZaRMU58uzgIbgX):
failed to open
public function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock =false);
        // return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }

2

Answers


  1. This sounds like a permission issue with your storage folder. The laravel documentation states:

    Directory Permissions
    After installing Laravel, you may need to configure some permissions. Directories >within the storage and the bootstrap/cache directories should be writable by your >web server or Laravel will not run.

    So try running the following on the server where you uploaded the code:

    sudo chmod -R 755 /storage
    sudo chmod -R 755 /bootstrap/cache
    

    Since you are running cpanel, instead of running these commands in the terminal, you can use these CPanel Instructions for updating your folder permissions.

    Login or Signup to reply.
  2. I recommend that you reset the whole project folders and files permissions to be suitable with hosting by these two terminal command

    sudo find path/to/root -type f -exec chmod 644 {} ;
    sudo find path/to/root -type d -exec chmod 755 {} ;
    

    and then

    sudo chmod -R 777 storage/
    sudo chmod -R 777 bootstrap/cache/
    
    chmod -R gu+w storage/
    chmod -R guo+w storage/
    

    also delete the old config.php file

    bootstrap/cache/config.php
    

    after the old config.php file deleted

    php artisan config:cache
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search