Search code examples
laravelvue.jscpanelweb-hostingdirectadmin

DirectAdmin web hosting error "Warning: file_exists(): open_basedir restriction in effect. File(/autoload.php) is not within the allowed path(s):"


I am trying to host a website(Laravel + Vue) via DirectAdmin but the site shows error. enter image description here

I don't know how to fix it. Please help me.


Solution

  • The PHP script is trying to access the folder for which access is not allowed. This restriction is defined by the PHP open_basedir variable for each domain separately.

    To turn off open_basedir on DirectAdmin, you need to possess administrative level privileges.

    Go to the Extra Features section Under PHP SafeMode Configuration > select Php Safe Mode Settings. Here, you have the option to either enable or disable open_basedir for your domains.

    The .htaccess file can be used to configure specific settings for your website that can be applied on a per-directory basis.

    By using the "php_admin_value open_basedir" directive in the .htaccess file, you can override the default open_basedir setting defined in the server's PHP configuration and limit the access of PHP scripts to specific directories. For example:

    php_admin_value open_basedir "/home/example/public_html/"