Post by Piercer » Thu May 26, 2022 6:54 pm

When installing OpenCart 4.0 I got an error - please help.

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/.composer:/home/web/local.net/public_html:/home/web/local.net/private:/home/web/local.net/public_shtml:/home/local.net/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/web/local.net/public_html/system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 91Twig\Error\LoaderError: The "/" directory does not exist ("/"). in /home/web/local.net/public_html/system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 92​

PHP Version 8.0.19
Linux 4.19.0-20-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64
Build Date May 17 2022 18:48:30
Server API FPM/FastCGI
MariaDB 10.5.16

open_basedir /home/.composer:/home/web/local.net/public_html:/home/web/local.net/private:/home/web/local.net/public_shtml:/home/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt

Newbie

Posts

Joined
Tue Apr 18, 2017 6:42 pm

Post by WaxedPerfection » Thu May 26, 2022 9:30 pm

this is worth a read... not 100% but reads very close to your errors.

Opencart Open_basedir restriction in effect
https://www.templatemonster.com/help/en ... ths-y.html

https://www.waxedperfection.co.uk/ Car Detailing Product Blog's and Review's


Active Member

Posts

Joined
Sun Mar 26, 2017 8:23 pm

Post by straightlight » Fri May 27, 2022 5:40 am

Piercer wrote:
Thu May 26, 2022 6:54 pm
When installing OpenCart 4.0 I got an error - please help.

Code: Select all

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/.composer:/home/web/local.net/public_html:/home/web/local.net/private:/home/web/local.net/public_shtml:/home/local.net/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) in /home/web/local.net/public_html/system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 91Twig\Error\LoaderError: The "/" directory does not exist ("/"). in /home/web/local.net/public_html/system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 92​
PHP Version 8.0.19
Linux 4.19.0-20-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64
Build Date May 17 2022 18:48:30
Server API FPM/FastCGI
MariaDB 10.5.16

Code: Select all

open_basedir	/home/.composer:/home/web/local.net/public_html:/home/web/local.net/private:/home/web/local.net/public_shtml:/home/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt
You'd need to contact your host to resolve this issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by adelante25 » Fri May 27, 2022 6:18 am

And, I am gettin the same error when trying to update;

Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/:/tmp:/var/tmp:/opt/alt/php74/usr/share/pear/:/dev/urandom:/usr/local/lib/php/:/usr/local/php74/lib/php/) in /home/:/public_html/system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 91Twig\Error\LoaderError: The "/" directory does not exist ("/"). in /home/vipgiy/domains/vipgiy.com/public_html/system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 92
Last edited by adelante25 on Sat May 28, 2022 1:31 am, edited 1 time in total.

Newbie

Posts

Joined
Mon Jan 04, 2021 3:28 am

Post by Piercer » Fri May 27, 2022 1:43 pm

Kindly tell me what extra open_basedir path should I add to my Apache2 so the script will work?
I don't want to use open_basedir = none option for safety reasons.
Thanks

Newbie

Posts

Joined
Tue Apr 18, 2017 6:42 pm

Post by agatha65 » Sun May 29, 2022 5:00 am

Piercer wrote:
Fri May 27, 2022 1:43 pm
Kindly tell me what extra open_basedir path should I add to my Apache2 so the script will work?
I don't want to use open_basedir = none option for safety reasons.
Thanks
try this
open
system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php
replace

Code: Select all

$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
with

Code: Select all

$checkPath = $this->rootPath.$path;
for some reason this fuction in the same file is not working correctly
private function isAbsolutePath(string $file): bool

Suppliers Module - XML, CSV, XLS Product Feed Import and Update
Rich Snippets | Facebook Open Graph Meta Tags | WebP Images
Image


User avatar
Active Member

Posts

Joined
Fri Mar 16, 2012 10:18 am
Location - Canada, QC

Post by Piercer » Sun May 29, 2022 5:46 pm

Excellent! It works. Thank you very much Agata! However 4.0.0 is still very raw =) installation goes fine but frontend is not possible to use. When adding an item into the cart is shows 0 (zero) in it. So I think 2.3.0.7 ver is my choice so far.

Newbie

Posts

Joined
Tue Apr 18, 2017 6:42 pm

Post by mlmayr » Fri Nov 18, 2022 4:41 am

Thanks helped me a lot!!!

Newbie

Posts

Joined
Fri Nov 18, 2022 4:37 am

Post by AsepSucipto » Fri Dec 02, 2022 1:48 pm

;) Thanks this work , nice solution

Newbie

Posts

Joined
Fri Dec 02, 2022 1:45 pm

Post by straightlight » Mon Dec 05, 2022 3:55 am

What deludes me with that solution is that I am using the same vendors' version with this original line code, and I don't get this error message with opencart-3's installation.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by asalpay » Mon Jan 02, 2023 9:58 pm

WORKED EXCELLENT!!!!
it has been two days i have been working on this problem, i contaced to my posting company they say "Shared hostings dont have opendir function," so i need to purches new hosting without sharing,
i dont know weather it is true or not, but your solution saved my day,
I really appriciated.

Newbie

Posts

Joined
Wed Dec 07, 2022 10:45 pm

Post by JNeuhoff » Mon Jan 02, 2023 11:08 pm

Piercer wrote:
Sun May 29, 2022 5:46 pm
So I think 2.3.0.7 ver is my choice so far.
There is no 2.3.0.7 version of OpenCart.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by DutchRider » Mon Jan 23, 2023 3:22 am

agatha65 wrote:
Sun May 29, 2022 5:00 am
Piercer wrote:
Fri May 27, 2022 1:43 pm
Kindly tell me what extra open_basedir path should I add to my Apache2 so the script will work?
I don't want to use open_basedir = none option for safety reasons.
Thanks
try this
open
system/storage/vendor/twig/twig/src/Loader/FilesystemLoader.php
replace

Code: Select all

$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
with

Code: Select all

$checkPath = $this->rootPath.$path;
for some reason this fuction in the same file is not working correctly
private function isAbsolutePath(string $file): bool
This solution worked fine for me too, upgrading from 3.0.2.0 to 4.0.1.1, same error message as OP. Your solution brought me a step further in the upgrading process (but still no working OC yet).

Newbie

Posts

Joined
Sun Oct 08, 2017 4:59 am

Post by Shop » Wed Feb 01, 2023 12:52 am

so it worked in the end, thank you all :D
Last edited by Shop on Wed Feb 01, 2023 4:40 am, edited 1 time in total.

Newbie

Posts

Joined
Sun May 31, 2020 10:28 pm

Post by iplocker » Sun May 19, 2024 5:35 pm

Hi.
I just had the same problem .
I solve it with your modification BUT why this problem is not official resolved ?
Does anyone report it ?
Thanks

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm


Post by ADD Creative » Sun May 19, 2024 6:15 pm

iplocker wrote:
Sun May 19, 2024 5:35 pm
Hi.
I just had the same problem .
I solve it with your modification BUT why this problem is not official resolved ?
Does anyone report it ?
Thanks
Official fix is https://github.com/opencart/opencart/pull/13450.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by paulfeakins » Mon May 20, 2024 9:46 pm

Piercer wrote:
Thu May 26, 2022 6:54 pm
When installing OpenCart 4.0
That's not an exact version, but at this point you should stick with 3.0.3.9.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 9 guests