Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vainway 's avatar

using symlink on hpanel/ cpannel

I had this problem for a long trying to create the storage link to my server and yesterday I saw a tutorial

about symlink and tried it, later got a problem while it creates a link in my hpannel :

public -> /domains/domain.com/public_html/storage/app/public

and tells me there is no such directory. I need your help guys I followed many links and more researches about this, nothing worked for me please help without sending links for others

the tutorial looks like this:

$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/public/storage';
symlink($targetFolder,$linkFolder);
echo 'Symlink process successfully completed';

I even get the message that "Symlink process successfully completed" and comes out with no real answer.

0 likes
13 replies
Snapey's avatar

why do you need to create a storage symlink?

vainway 's avatar

@snapey my problem is when I try to upload an image on my site, it doesn't show up and show like there is no image.

Snapey's avatar

why not save it directly to the public folder?

vainway 's avatar

@snapey that is what I want to do but am not able to do so

before hosting my website it was working well, then when I upload my website that happened

Snapey's avatar

Well unfortunately the main problem is that your hosting is messed up, which I can tell because you seem to have your whole project in the public_html folder.

So either you messed around with htaccess and moving index.php and crazy stuff like that, else someone can just go to your website and enter /.env and see all your secrets.

If you hosted correctly with the public folder as the document root then other things would just magically work as the way they were intended.

vainway 's avatar

@snapey yeah my whole website was in the public_html folder not working, I change it also and took all files for

public folder in the public_html only and the other files outside the public_html folder but still not working.

or I can paste it up my codes of Html and controller and see if there is something

vainway 's avatar

@snapey the link you gave me I don't why it doesn't open for me, every time I try to go on

medium.com shows me that I can't reach the site.

Please or to participate in this conversation.