Search code examples
phpxamppsmarty

Error accessing template file in Samrty in xammp


I'm creating a project in XAMPP and have started to use the Smarty template for PHP.

However, after creating my controller and views and then viewing the application in the browser I get this error:

Fatal error: Uncaught --> Smarty: unable to write file /Applications/XAMPP/xamppfiles/htdocs/smarty/templates_c/wrt601727fe4da8d5_80519194 <-- thrown in /Applications/XAMPP/xamppfiles/htdocs/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php on line 60

Line 60 in that file is:

// write to tmp file, then move to overt file lock race condition
$_tmp_file = $_dirpath . DIRECTORY_SEPARATOR . str_replace(array('.', ','), '_', uniqid('wrt', true));
if (!file_put_contents($_tmp_file, $_contents)) {
    error_reporting($_error_reporting);
    throw new SmartyException("unable to write file {$_tmp_file}");
}

Can anyone see the issue?


Solution

  • Smarty could not access the templates_c folder in Xamp directory, after uploading to a server it worke perfectly