"OPEN_BASEDIR restriction in effect" when navigating in PHP script

**My website URL is:**https://layco.ml

**What I’m seeing is:**equire(): open_basedir restriction in effect. File(…/vendor/autoload.php) is not within the allowed path(s): …

**I’m using this software:**Only PHP

**Additional information:**Im using Zend and phpdotenv, but they shouldn’t be important.

I cant navigate into folders im usually allowed to access like the root htdocs folder.
The error even comes up when i navigate a folder down into a sub-directory of my site.

Scripts can only write to the htdocs directories they are in. Any directories outside the htdocs dir cannot be written - due to the open_basedir restriction (is set for security reasons).

It’s probably wrongly defined somewhere in some of your scripts


Im always navigating inside the htdocs folder,
But i cant use things like DIR or … (even if im in a subfolder in a subfolder in htdocs.)

Let me visualize it:
I following two important folders in htdocs directory:
Vendor(Composer) and modules.
in the modules directory, theres a file called api.php, wich tries to require the file autoload.php in Vendor.
But i cant access the lower directory, but i should be able to

On free hosting, PHP scripts are restricted so they can only access the web document root of the domain they are executing on. This means that all the files your code needs to access should be in the htdocs folder of the domain you’re trying to access.

This includes the vendor folder of Composer.

Some scripts, CMS and frameworks recommend storing certain folders outside the htdocs directory. This is not supported on free hosting. This is done to prevent situations like one malware infected website infecting all other sites in the same account.

1 Like

everything is in the htdocs folder, cant use ‘…’ in any case tho

The open_basedir restriction controls which folders can be accessed by a PHP script. To my knowledge, it does not limit which navigation controls you can use to navigate within those directories.

I’m not sure what the triple dot ... normally does. I can see behavior in Windows, but in Linux, I only know of the single and double dot.

If you are trying to access a file through the triple dot notation and you get an open_basedir error, that probably means your path is resolved to something outside of your htdocs directory.

Maybe running the triple dot path through the realpath function tells you what the calculated path is and whether that’s the right path. Or you could try to specify the path without the triple dots and see if that helps.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.