Appearance
Enable the Storage Link in Laravel on cPanel
Step 1: Access Your cPanel
Log in to the cPanel account provided by your hosting provider.
Step 2: Use the Terminal (If Available)
If your cPanel includes the Terminal feature, you can create the storage link using the Artisan command.
Navigate to your Laravel project's root directory (for example, public_html or public_html/your-app) and run:
bash
php artisan storage:linkIf the Terminal option is not available, follow the next step.
Step 3: Create the Storage Link Manually
If you cannot access the Terminal, you can create the symbolic link manually.
- Open File Manager in cPanel.
- Navigate to your Laravel project directory.
- Verify that the
storage/app/publicdirectory exists. - Check whether
public/storagealready exists. If it is an incorrect folder or link, remove it. - Create the symbolic link by running the following command from the project directory (if SSH or Terminal access is available):
bash
ln -s ../storage/app/public public/storageStep 4: Set the Correct Permissions
Make sure the following directories have the correct permissions:
storagebootstrap/cache
In File Manager, right-click each folder, select Change Permissions, and set the permissions to 775 (or 755, depending on your hosting provider's requirements).
Step 5: Verify the Storage Link
After creating the symbolic link, the following path:
text
public/storageshould point to:
text
storage/app/publicStep 6: Test File Access
Upload a file (for example, test.jpg) to:
text
storage/app/publicThen open the following URL in your browser to verify that the storage link is working:
text
https://your-domain.com/storage/test.jpgTroubleshooting
Symbolic Links Are Not Allowed
If your hosting provider does not allow symbolic links, contact their support team to enable this feature or ask for an alternative solution.
Files Are Not Accessible
Make sure the APP_URL value in your .env file is set correctly.
env
APP_URL=https://your-domain.comOnce these steps are completed, the Laravel storage link will be configured successfully.
