Search code examples
phplaravelheroku

How to access Laravel symbolic link when uploaded to Heroku


I'm making a laravel webapp and I'm trying to access a image in a storage symbolic link /storage/images/face-ph.png.

It works when I do it locally like this:

<img src="/storage/images/face-ph.png>

However when I upload it to Heroku it can't find the path.


Solution

  • if you are using Heroku for your deployment you can try

    heroku run bash
    php artisan storage:link
    

    OR

    heroku run /app/php/bin/php /app/www/artisan storage:link
    

    you can use an absolute path or relative path to run binaries

    Hope this helps