How to access Laravel symbolic link when uploaded to Heroku How to access Laravel symbolic link when uploaded to Heroku heroku heroku

How to access Laravel symbolic link when uploaded to Heroku


Adnan's answer has two issues;

  • If you use heroku run bash to execute a command, it's only executed in a one-off dyno. So this won't effect the live dyno.
  • The php artisan storage:link command generates a symlink with an absolute path. So when you'd run this during build, it'd map the absolute path of a temp build directory, instead of the final app's directory on the dyno.

I used a simple relative symlink to link both directories and add it to your git repository:

cd public/ && ln -s ../storage/app/public storage && cd ..


if you are using Heroku for your deployment you can try

heroku run bashphp 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