Now, we will learn how create symbolic link in a shared hosting using PHP
In Laravel documentation, a symbolic link (symlink or soft link) from public/storage to storage/app/public should be created to make files accessible from the web.
Create a symlink.php file:
$targetFolder = '/home/your_account/your_project_src/storage/app/public';
$linkFolder = '/home/your_account/your_domain.com/storage';
symlink($targetFolder, $linkFolder);
echo 'Symlink process successfully completed';
Upload to public_html or your domain folder and run this symlink.php file:
http://your_domain.com/symlink.php
Done! A folder named storage will be created to link path with an indicator >>> on the folder icon.
Happy Coding:)
Latest comments (2)
Thank you for providing guidance on creating a symbolic link in a PHP hosting environment! PHP hosting offers more flexibility and control compared to shared hosting, making it an excellent choice for projects like Laravel.
Your clear and concise steps have empowered anyone to set up their symbolic link and leverage the benefits of PHP hosting. Having this increased control over the server environment allows to optimize performance and security for any Laravel project.
I ditched shared hosting for managed cloud hosting because the prior had so many limitations. As a web developer who is managing a lot of clients at a time, I had to choose the best hosting that offered the choice of having unlimited websites on one platform. I tried out a 3 day free trial offered by Cloudways and was mindblown with the user-friendliness of the platform. It’s been 8 months and I am super satisfied with Cloudways performance, my website’s speed, and the flexibility I get to scale the serve according to my needs. When it comes to hosting, I always look for a pay as you go model and Cloudways luckily has the same. I am never going back to shared hosting again.