Puriom Posted February 14, 2022 Share Posted February 14, 2022 Hello! My about 10th PS installation among last years, first time such a message in completely fresh install: Quote Warning on line 2509 in file /var/www/vhosts/MY X SITE.link/classes/module/Module.php [2] file_exists(): open_basedir restriction in effect. File(/views/templates/hook/HookDashboardZoneTwo.tpl) is not within the allowed path(s): (/var/www/vhosts/MY X SITE.link/:/tmp/) It came after a fatal error when installing "PrestaShop Account" module, which gave a fatal error (500) and I had to rename modules/ps_accounts. That brought back the backoffice but with the above issue. I have Php v7.4.27 I added Lets Encrypt just to be able to see the site (is there any other way?) and the only other modules I have are the few basics (p.e. 1click, etc). I used Plesk automatic installation and I updated it with 1-click update. (I found this but I cannot use it.https://github.com/PrestaShop/PrestaShop/issues/26783 These are my 2504-2512 lines } if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) { if (false === strpos($template, 'module:') && !file_exists(_PS_ROOT_DIR_ . '/' . $template) && !file_exists($template) ) { $template = $this->getTemplatePath($template); } How it should be?) Thank you for any Kind help Link to comment Share on other sites More sharing options...
Puriom Posted February 15, 2022 Author Share Posted February 15, 2022 (edited) I was afraid it wouldn't work on 1.7.8.3 but it worked. As I'm not a programmer I was hesitating, but it's OK. Edited February 15, 2022 by Puriom (see edit history) Link to comment Share on other sites More sharing options...
MarioCM Posted March 3, 2022 Share Posted March 3, 2022 I have the same warning on 1.7.8.3 (php 7.4) I have tried a new clean installation and the same warning happens to me with the debugging mode activated. 🤔 It seems as if it does not redirect well in the hosting subdomain. Any ideas?🙄 Link to comment Share on other sites More sharing options...
Puriom Posted March 3, 2022 Author Share Posted March 3, 2022 14 minutes ago, MarioCM said: I have the same warning on 1.7.8.3 (php 7.4) I have tried a new clean installation and the same warning happens to me with the debugging mode activated. 🤔 It seems as if it does not redirect well in the hosting subdomain. Any ideas?🙄 Hello. Via FTP of File Manager find this file: MY X SITE.link/classes/module/Module.php on line 2509, replace the lines there with what you see below (as written in the link above - which worked for me): protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null) { if ($compile_id === null) { $compile_id = $this->getDefaultCompileId(); } if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) { if (false === strpos($template, 'module:') && !file_exists(_PS_ROOT_DIR_ . '/' . $template) && !file_exists(_PS_ROOT_DIR_ . $template) ) { $template = $this->getTemplatePath($template); } $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id] = $this->context->smarty->createTemplate( $template, $cache_id, $compile_id, $this->smarty ); } return $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id]; }` 2 2 Link to comment Share on other sites More sharing options...
MarioCM Posted March 4, 2022 Share Posted March 4, 2022 OOk, thanks! Works fine for me too 🤗 Link to comment Share on other sites More sharing options...
psychoDad Posted April 28, 2022 Share Posted April 28, 2022 I had the same problem. I confirm - the solution works. Thanks Bro! Peace! Link to comment Share on other sites More sharing options...
user8139 Posted November 17, 2022 Share Posted November 17, 2022 I'll change line 2509 to ! file_exists(_PS_ROOT_DIR_ . $template) The problem remains unresolved Please help me, thank you Link to comment Share on other sites More sharing options...
José M. Posted July 19, 2023 Share Posted July 19, 2023 On 3/3/2022 at 5:27 PM, Puriom said: Hello. Via FTP of File Manager find this file: MY X SITE.link/classes/module/Module.php on line 2509, replace the lines there with what you see below (as written in the link above - which worked for me): protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null) { if ($compile_id === null) { $compile_id = $this->getDefaultCompileId(); } if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) { if (false === strpos($template, 'module:') && !file_exists(_PS_ROOT_DIR_ . '/' . $template) && !file_exists(_PS_ROOT_DIR_ . $template) ) { $template = $this->getTemplatePath($template); } $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id] = $this->context->smarty->createTemplate( $template, $cache_id, $compile_id, $this->smarty ); } return $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id]; }` I've been looking for this for hours! Much thanks!!!! Link to comment Share on other sites More sharing options...
DARKF3D3 Posted October 1 Share Posted October 1 On 03/03/2022 at 5:27 PM, Puriom dice: Hello. Via FTP of File Manager find this file: MY X SITE.link/classes/module/Module.php on line 2509, replace the lines there with what you see below (as written in the link above - which worked for me): protected function getCurrentSubTemplate($template, $cache_id = null, $compile_id = null) { if ($compile_id === null) { $compile_id = $this->getDefaultCompileId(); } if (!isset($this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id])) { if (false === strpos($template, 'module:') && !file_exists(_PS_ROOT_DIR_ . '/' . $template) && !file_exists(_PS_ROOT_DIR_ . $template) ) { $template = $this->getTemplatePath($template); } $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id] = $this->context->smarty->createTemplate( $template, $cache_id, $compile_id, $this->smarty ); } return $this->current_subtemplate[$template . '_' . $cache_id . '_' . $compile_id]; }` This is supposed to works on PS8.1 too? Link to comment Share on other sites More sharing options...
przemex Posted December 9 Share Posted December 9 Yes, this method also works in PrestaShop 8.x.x, but you have to find the code because it is on a different line in this file but it is the same and you change it to the one given above. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now