最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin4浏览0评论

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.

  1. 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.

  1. 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?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论