Laravel on Hostinger: "Missing Storage Symlink" & symlink() Not Working – Alternative Solutions?

Updated: Feb 21, 2025

Laravel on Hostinger: "Missing Storage Symlink" & symlink() Not Working – Alternative Solutions?

When deploying a Laravel application on Hostinger, you might encounter an error message saying "Missing Storage Symlink" or "Storage:class.base.php:117 Symbolic link Storage/public/storage missing" when running the php artisan serve command. This error occurs because Hostinger's shared hosting environment does not support symbolic links by default.

To resolve this issue, there are several alternative solutions you can try:

  1. Manual Symlink Creation

You can create the symlink manually using SSH access to your Hostinger account. Follow these steps:

a. Connect to your Hostinger account using SSH. b. Navigate to the public directory of your Laravel application: cd path/to/your/laravel/public. c. Create the storage symlink using the following command: ln -s ../storage/app/public ../storage. d. Create the public symlink using the following command: ln -s ../storage/app/public/public ../public.

  1. Use a Custom Storage Disc

Instead of using symbolic links, you can configure Laravel to use a custom storage disk. This method involves uploading the contents of the storage directory to the public directory and setting up a custom disk in Laravel.

a. Upload the contents of the storage directory to the public directory using an FTP client or SSH. b. Open the .env file in your Laravel project and set the APP_URL to the URL of your Hostinger account, for example: APP_URL=http://yourdomain.com. c. Create a new file called storage.php in the config/filesystems.php directory and add the following code:

return [
    'disks' => [
        'public' => [
            'driver' => 'local',
            'root' => public_path('storage'),
        ],

        'custom' => [
            'driver' => 'local',
            'root' => base_path('public/storage'),
        ],
    ],
];

d. Update the app/Providers/AppServiceProvider.php file to use the custom disk:

use Illuminate\Support\Facades\Storage;

public function boot()
{
    Storage::extend('custom', function ($app) {
        return Storage::disk('custom');
    });
}

e. Update the config/filesystems.php file to use the custom disk for the public and assets directories:

'public' => [
    'driver' => 'custom',
],

'assets' => [
    'driver' => 'custom',
],
  1. Use a Third-Party File Manager

Another alternative solution is to use a third-party file manager like FileZilla or CPanel to manage your Laravel application's files. This method allows you to upload and manage files directly from the file manager without the need for symbolic links or custom disks.

In conclusion, when deploying a Laravel application on Hostinger and encountering the "Missing Storage Symlink" error, you can try creating the symlink manually, using a custom storage disk, or using a third-party file manager as alternative solutions.