I installed the JustFans script from CodeCanyon on Hostinger hosting, but when trying to upload images, they do not appear on the website, even though they exist in the public/uploads folder.
I also found the following error message in the admin panel:
Missing storage symlink
We could not find a storage symlink. This could cause problems with loading media files from the browser.
When I tried running:
php artisan storage:link
I got this error:
Call to undefined function Illuminate\Filesystem\symlink()
I tried this manual fix, and it worked, but I need it to run automatically:
mkdir -p public/storage
cp -r storage/app/public/* public/storage/
I attempted to set up a Cron Job in Hostinger with the following command:
* * * * * cp -r /home/your-username/storage/app/public/* /home/your-username/public_html/storage/
However, it did not run automatically.
- Running php artisan storage:link
- Expected: It should create a symbolic link from storage/app/public to public/storage.
- Result: Got the error:
Call to undefined function Illuminate\Filesystem\symlink()
This means the symlink() function is disabled on my Hostinger server. 2. Manually Copying Files
- Command Used:
mkdir -p public/storage
cp -r storage/app/public/* public/storage/
- Expected: The images should be accessible in the browser. - Result: This worked, but I had to run the command manually every time new media was uploaded.
- Setting Up a Cron Job on Hostinger
- Command Used:
* * * * * cp -r /home/your-username/storage/app/public/* /home/your-username/public_html/storage/
- Expected: The cron job should automatically copy new media every minute. - Result: It did not execute as expected.
Next Steps: I need a fully automated solution where media files are always accessible without having to manually copy them. Looking for alternatives to symlink() that work on Hostinger.
Any advice or alternative approaches?