skip to Main Content

I am using laravel 10 and php version 8.1, i have deployed my project on c-panel , i have cloned the project successfully , i have moved my files from public to public_html and the remaining files are in my laravel directory, i have created the symlink using this command,


ln -s /home/your_cpanel_username/path/to/your/laravel/project/storage/app/public /home/your_cpanel_username/public_html/storage

the link is created successfully , but i still cannot access my storage folder,

i have checked the permissions also , the permissions are also fine, the images are bing saved into the storage/app/public/performa_invoices folder

i have tried updating the filesystems.php file in my config :

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => env('FILESYSTEM_DISK', 'local'),

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been set up for each driver as an example of the required values.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'throw' => false,
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage/app/public',
            'visibility' => 'public',
            'throw' => false,
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
            'throw' => false,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Symbolic Links
    |--------------------------------------------------------------------------
    |
    | Here you may configure the symbolic links that will be created when the
    | `storage:link` Artisan command is executed. The array keys should be
    | the locations of the links and the values should be their targets.
    |
    */

    'links' => [
        base_path('public_html/storage') => storage_path('app/public'),
    ],

];

also changed the

FILESYSTEM_DISK=public

in my env , still cannot access, tried some other things but cannot access , i am fedup with the issue , any help regarding that will be appreciated

2

Answers


  1. To make these files accessible from the web, you should create a symbolic link from public/storage to storage/app/public

    php artisan storage:link
    
    Login or Signup to reply.
  2. These are the configurations you made to the filesystem.php

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'throw' => false,
    ],
    
    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage/app/public',
        'visibility' => 'public',
        'throw' => false,
    ],
    

    These is what the laravel has by default

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
        'throw' => false,
    ],
    
    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
        'throw' => false,
    ],
    

    Please check the root path for the local driver 'root' => storage_path('app'), and url for public driver 'url' => env('APP_URL').'/storage',

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search