I've set it up so that my uploaded images are stored in the storage directory, then I set it up so that a symbolic link makes those images appear in the public directory too. Everything works fine in my local host, but production doesn't set up the link or new directory in public. Here's what I've done so far:
Established the link in filesystems.php with this:
Switched the FILESYSTEM_DISK in .env from local to public.
I couldn't run the command php artisan storage:link with a terminal in production, but StackOverflow suggestions helped me find a roundabout way of doing it. This caused me to use this temporary route in web.php like this:
Route::get('/run-storage-link', function () {
Artisan::call('storage:link');
});
However, running this command with the route results in this error: Call to undefined function Illuminate\Filesystem\exec(). I can tell that the image are making it into the storage directory, but that symbolic link isn't getting established. Any ideas?
Sounds like your hosting company has disabled the use of exec() on the server, so that workaround wont work for you. Either ask them to enable exec() for your site, or find a way to ssh into the server to run in on the CLI. Or change hosting company.