PHP - Set root directory without chroot

Helloooo.

I wonder if it’s possible to make php look for files in a specified directory (e.g /site/rootfolder) when “/” is used in functions like file_get_contents, but still be able to access things like mysql functionality outside this specified root

Is this possible without chroot?

If there was a function like this: exceptions(“allowed/include paths”) then it could be combined with chroot. Maybe there is?

What is the real problem you are trying to solve?

It simplifies, the setup is more elegant and it becomes more logical for my users

That doesn’t tell me anything. Give high level overview of what you have going on and what a solution, whatever is does to “simplifies, the setup is more elegant and it becomes more logical for my users”.