How to Fix error: realpath(): open_basedir restriction in effect

Fix error: realpath(): open_basedir restriction in effect

 

During Magento installation on VestaCP CentOS you may have problem:

[error] PHP Warning:  realpath(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/admin/web/mydomain.com/public_html:/home/admin/tmp) in /home/admin/web/mydomain.com/public_html/vendor/magento/framework/Filesystem/DirectoryList.php on line 99

For fixing that error add /tmp into /home/admin/conf/web/httpd.conf Apache config file open_basedir:

<Directory /home/admin/web/mydomain.com/public_html>
        AllowOverride All
        Options +Includes -Indexes +ExecCGI
        php_admin_value open_basedir /home/admin/web/mydomain.com/public_html:/home/admin/tmp:/tmp
        php_admin_value upload_tmp_dir /home/admin/tmp
        php_admin_value session.save_path /home/admin/tmp
</Directory>

And then reboot server

 

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

One Comment

  1. Hi there,
    I tried to fix the error with your solution but it didn’t work, the webfsite is not running.

Leave a Reply

Your email address will not be published. Required fields are marked *