Openbasedir error after migrating prestashop 1.7

Hi, I have the following error after migrating a prestashop 1.7 website.

Warning op lijn 52 in bestand /home/example/web/example.com/public_html/modules/ps_metrics/vendor/prestashop/prestashop-accounts-auth/src/Environment/Env.php
[2] file_exists(): open_basedir restriction in effect. File(/home/example/web/example.com/public_html.env) is not within the allowed path(s): (/home/example/.composer:/home/example/web/example.com/public_html:/home/example/web/example.com/private:/home/example/web/example.com/public_shtml:/home/example/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt)

I tried to follow steps on editing openbasedir but I didnt know where to start.

Hello @masdatli,

What did you try?

The best way should create a php-fpm template (cloning it from the php template version you are using in your site) for your prestashop site, modify the template to include dir /home/%user%/web/%domain%/public_html.env to php_admin_value[open_basedir] directive and use that template in your prestashop site.

More info about templates here:

Cheers,
sahsanu

Hi @sahsanu I tried that, made anew template and chose that for the particular account, but still same problem. I think my prestashop system has bugs in the that it cant determine the correct root folder and thus wants to access files through file_exists() which are above the root folder which the mentioned account doesnt have permission to access.

It is weird because the same code didnt have the same errors on another server.

I know nothing about prestashop so I can’t help here. Anyway, to try to workaround the issue, as you already added the dir to open_basedir, you could try to create the folder prestashop wants to use.

As root:

mkdir /home/YourUser/web/YourDomain/public_html.env`
chown YourUser:www-data /home/YourUser/web/YourDomain/public_html.env

And try again.

Cheers,
sahsanu

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