Create a symlink in CPanel without SSH access
Today I have to deploy a Laravel project to CPanel hosting that is quite limited in feature, there is no SSH access to it which that is a necessary thing for a project like Laravel, terminal commands are often used, the one example is creating a symlink.
I was upset at first but fortunately, there is one way to achieve this, we can use Cron Jobs for that. Since I have never touched something like Cron Jobs before so a bit surprisingly for me that we can use a bash command ๐
The step is just to create one job with any time schedule, or simply use the per-5 minute one then writes your command, in this case, we want to create a symlink from storage/app/public to public/storage.
The full command would be:
ln -s /home/user/LARAVEL/storage/app/public /home/user/PUBLIC/storage
Change user with your CPanel username, the LARAVEL folder here means I store my whole Laravel project files into that folder and publish the public folder into PUBLIC, I mean you can freely rename both LARAVEL & PUBLIC folder as you want, for more information about how I deploy a Laravel project or something similar you can check my previous post: Deploy Laravel project to CPanel / Shared Hosting.