Jump to content

[SOLVED]Smarty error after moving the site from subfolder to root


Recommended Posts

I have moved my site from subfolder into the root and Im getting
a blank front page. The BO works fine.

The error I get is

PHP Fatal error:  Smarty error: the $compile_dir 'C:\Webs\......\DIGIWAY-CY.COM/tools/smarty/compile' does not exist, or is not a directory. in C:\Webs\.....\DIGIWAY-CY.COM\tools\smarty\Smarty.class.php on line 1095



I did a check and there is no "compile" directory in there.

I also check the smarty.config.inc.php and here are the settings

require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir     = _PS_THEME_DIR_.'tpl';
$smarty->compile_dir     = _PS_SMARTY_DIR_.'compile';
$smarty->cache_dir         = _PS_SMARTY_DIR_.'cache';
$smarty->config_dir     = _PS_SMARTY_DIR_.'configs';
$smarty->caching         = false;
$smarty->force_compile    = true; // to pass "false" when put into production
$smarty->compile_check    = false;
//$smarty->debugging        = true;
$smarty->debug_tpl        = _PS_ALL_THEMES_DIR_ . 'debug.tpl';



Any suggestions?
Do I have to cretae that directory?

Link to comment
Share on other sites

The things got worst.

I am getting many errors like

PHP Warning:  include(C:\Webs\....\DIGIWAY-CY.COM/tools/smarty/compile\%`^60A^60AD786D%%header.tpl.php): failed to open stream: No such file or directory in C:\Webs\....\DIGIWAY-CY.COM\tools\smarty\Smarty.class.php on line 1266



PHP Warning:  include(): Failed opening 'C:\Webs\....\DIGIWAY-CY.COM/tools/smarty/compile\%`^60A^60AD786D%%header.tpl.php' for inclusion (include_path='.;C:\php5\pear') in C:\Webs\....\DIGIWAY-CY.COM\tools\smarty\Smarty.class.php on line 1266



And an other 140 of these for all my modules.

Link to comment
Share on other sites

I don't know how your compile directory got deleted when you moved PrestaShop. I suggest that you edit tools/Smarty.class.php and change 'force_compile' to true. Hopefully, that will recompile all the files into the compile directory for you. I hope no other directories were lost in the move.

EDIT: I see that you've already done that. I can't think of any other solution other than to start over from scratch and then coping over your theme files and any other files you changed.

Link to comment
Share on other sites


EDIT: I see that you've already done that. I can't think of any other solution other than to start over from scratch and then coping over your theme files and any other files you changed.


No I have not done that. The var $force_compile by default was false; and it still is.

the Only change was var $compile_check that by default it was true and I changed it to false along with
var $caching from 0 to 1 as you suggested in performance tips. But now they are both as default.

var $compile_check = true;
var $force_compile = false;
var $caching = 0;
Link to comment
Share on other sites

It is normal for Smarty to compile your tpl files into php files like those you mentioned above. Have you tried changing "force_compile" to true to see whether that fixes all the missing compiled file errors?

Link to comment
Share on other sites

OK I have clean my error log and testing if the errors will come back.

Settings now are

var $compile_check   =  true;
var $force_compile   =  true;
var $caching         =  0;



There is a new error in BO when trying to delete a category image.
object cannot be loaded
and in error log it gives

PHP Warning:  unlink(C:\Webs\....\DIGIWAY-CY.COM/img/c/57.jpg): Permission denied in C:\Webs\....\DIGIWAY-CY.COM\classes\AdminTab.php on line 368
PHP Warning:  imagejpeg(): Unable to open 'C:\Webs\....\DIGIWAY-CY.COM/img/c/57-category.jpg' for writing: Permission denied in C:\Webs\....\DIGIWAY-CY.COM\images.inc.php on line 236
PHP Warning:  imagejpeg(): Unable to open 'C:\Webs\....\DIGIWAY-CY.COM/img/c/57-large.jpg' for writing: Permission denied in C:\Webs\....\DIGIWAY-CY.COM\images.inc.php on line 236
PHP Warning:  imagejpeg(): Unable to open 'C:\Webs\....\DIGIWAY-CY.COM/img/c/57-medium.jpg' for writing: Permission denied in C:\Webs\....\DIGIWAY-CY.COM\images.inc.php on line 236
PHP Warning:  imagejpeg(): Unable to open 'C:\Webs\....\DIGIWAY-CY.COM/img/c/57-small.jpg' for writing: Permission denied in C:\Webs\....\DIGIWAY-CY.COM\images.inc.php on line 236

Link to comment
Share on other sites

Is there anything in the database that has to do with permissions?

And Im thinking of one other thing. Maybe my account has o quota and because the
img directory is huge it can block me from editing. What do you think?

Link to comment
Share on other sites

No, there are no permissions in the database.

Yes, it is possible that there are too many images in your img/p directory or that you've reached the maximum file quota. You'll have to check your cPanel to see how much of your quota you have used.

Link to comment
Share on other sites

For the moment it seems to work fine but slow.
Should I set the force compile back to false?

The setting now are:

var $compile_check   =  true;
var $force_compile   =  true;
var $caching         =  0;



And what about the settings in /config/smarty.inc.php
Will this do any conflict with the other settings?

require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir     = _PS_THEME_DIR_.'tpl';
$smarty->compile_dir     = _PS_SMARTY_DIR_.'compile';
$smarty->cache_dir         = _PS_SMARTY_DIR_.'cache';
$smarty->config_dir     = _PS_SMARTY_DIR_.'configs';
$smarty->caching         = false;
$smarty->force_compile    = true; // to pass "false" when put into production
$smarty->compile_check    = false;
//$smarty->debugging        = true;
$smarty->debug_tpl        = _PS_ALL_THEMES_DIR_ . 'debug.tpl';

Link to comment
Share on other sites

If everything is working again, then you should be able to turn force compile off and turn caching back on. I wasn't aware of those settings in config/smarty.config.inc.php. I'm not sure whether they override the options in tools/smarty/Smarty.class.php. From looking at the code, I would expect them to override the options, but then my performance tip to enable Smarty caching should never have worked.

Link to comment
Share on other sites

Yes you are right that the tip does the job and it does not seem to be ignored from the other settings,
but I just can't understand why the developers left a duplicated code. Is that the same in your files too?

Now in case I need to make some changes, what should be the settings?
i.e. I need to make this for now.
Should I leave the settings as they are and change them after the modification?

Link to comment
Share on other sites

It looks like the PrestaShop team created a Smarty configuration file to override the default Smarty settings. Now that I think about it, it does make more sense to override the default values rather than changing the default values.

It should be safe to turn on Smarty caching like you had before now.

Link to comment
Share on other sites

  • 2 weeks later...

Hi
Me 2 i have the some problem with smarty. i have errors message in my screen like Warning: Smarty error: [in C:\wamp\www\..../homefeatured.tpl line 19]: syntax error: plugin function smarty_compiler_continue() not found in C:\wamp\www\????\tools\smarty\plugins\compiler.continue.php (Smarty_Compiler.class.php, line 656) in C:\wamp\www\????\tools\smarty\Smarty.class.php on line 1095 and i can't find the origin of this problem may be coz i'm PS bigenner and i dont know the structure of PS.
Plz help
Thx

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...