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

mikebx's avatar

Symlinks issues with __DIR__

Hello,

we want to deploy a Laravel app with shared bootstrap and storage directories, but we are facing the problems with __DIR__ resolving symbolic links. We have the following directories structure:

/app/current <- symlink to current version
/app/current/bootstrap <- symlink to ../bootstrap
/app/current/storage <- symlink to ../storage
/app/<git tag/branch name> <- directories with versions
/app/bootstrap <- actual bootstrap dir
/app/storage <- actual storage dir

But there is a problem with autoload (and even vendor files) using __DIR__. It gets the wrong path - eg in bootstrap/autoload.php:

require __DIR__/../vendor/autoload.php
should get /app/current/bootstrap/../vendor/autoload.php
but it gets /app/bootstrap/../vendor/autoload.php (this is incorrect).

Is there any hack to solve this? One can't do anything with __DIR__ behaviour and I don't want to update vendor files.

Any suggestions? Thank you! Michal

0 likes
1 reply
luiz's avatar

Did you solved ??

I have the same problem !!

Please or to participate in this conversation.