Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

filemtime() [function.filemtime]: stat failed
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
hafanka
Smarty n00b


Joined: 30 Mar 2012
Posts: 4

PostPosted: Tue Apr 03, 2012 3:12 pm    Post subject: filemtime() [function.filemtime]: stat failed Reply with quote

Hello,

I'm following a book on PHP and MySql to create my own website and I came across the following error. I've searched online and found familiar problems which mention to add Smarty::muteExpectedErrors(). I'm not sure which script I need to add it to, I've added it to setup_smarty.php before but nothing changes. I'm a beginner with PHP and would really appreciate a step by step instruction on solving below error. I have a feeling that because the book is a few years back it might be going according to an older version of Smarty, so I also post the setup_smarty.php (original from the book) for you to evaluate. I really appreciate all your help. Thank you, Natasha.

setup_smarty.php

<?php
// Reference Smarty library
require_once SMARTY_DIR .'Smarty.class.php';
// Reference our configuration file
require_once 'config.inc.php';

// Class that extends Smarty, used to process and display Smarty files
class Page extends Smarty
{
// constructor
function _construct()
{
// Call Smarty's constructor
$this->Smarty();
// Change the default template directories
$this->template_dir = TEMPLATE_DIR;
$this->compile_dir = COMPILE_DIR;
$this->config_dir = CONFIG_DIR;
$this->plugins_dir[0] = SMARTY_DIR . 'plugins';
$this->plugins_dir[1] = SITE_ROOT . "/smarty_plugins";
}
}
?>

***ERROR after loading the page***

ERRNO: 2
TEXT: filemtime() [function.filemtime]: stat failed for .\templates_c\fbbb23b49fd419b9f237605569a376d50cb4695f.file.departments_list.tpl.php
LOCATION: C:\xampp\smarty\libs\sysplugins\smarty_resource.php, line 693, at April 3, 2012, 4:35 pm
Showing backtrace:
filemtime(".\templates_c\fbbb23b49fd419b9f237605569a376d50cb4695f.file.depa...") # line 693, file: C:\xampp\smarty\libs\sysplugins\smarty_resource.php
Smarty_Template_Source.getCompiled(Object:Smarty_Internal_Template) # line 644, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.__get("compiled") # line 154, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch(null, null, null, null, false, false, true) # line 285, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.getSubTemplate("departments_list.tpl", null, null, null, null, Array[0], "0") # line 41, file: C:\pichek\templates_c\749422d4cfc3eb5677cf499730392b6accd4d1c7.file.index.tpl.php
content_4f721656756b70_89347584(Object:Smarty_Internal_Template) # line 180, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch("index.tpl", null, null, null, true) # line 374, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.display("index.tpl") # line 10, file: C:\pichek\index.php



Please let me know if any other information is needed in order to solve the problem.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Apr 03, 2012 8:18 pm    Post subject: Reply with quote

Note that if you are extending Smarty 3 you must call PHP 5 contructors and must use the setter methods like setTemplateDir() to configure the directories.

See http://www.smarty.net/docs/en/installing.smarty.extended.tpl

Code:
class Page extends Smarty
{
// constructor
function  __construct()
{
// Call Smarty's constructor
parent::__construct();
// Change the default template directories
$this->setTemplateDir(TEMPLATE_DIR);
$this->setCompileDir(COMPILE_DIR);
$this->setConfigDir(CONFIG_DIR);
$this->setPluginsDir(array(SMARTY_DIR . 'plugins', SITE_ROOT . "/smarty_plugins");
}
}
Back to top
View user's profile Send private message
hafanka
Smarty n00b


Joined: 30 Mar 2012
Posts: 4

PostPosted: Tue Apr 03, 2012 8:52 pm    Post subject: Reply with quote

Thank you! I've made changes you suggested and now this error comes up:

Quote:
ERRNO: 2
TEXT: filemtime() [function.filemtime]: stat failed for C:\pichek/templates_c\c6745c4e046efa9b946f033345d44509baa737d4.file.index.tpl.php
LOCATION: C:\xampp\smarty\libs\sysplugins\smarty_resource.php, line 693, at April 3, 2012, 10:47 pm
Showing backtrace:
filemtime("C:\pichek/templates_c\c6745c4e046efa9b946f033345d44509baa737d4.f...") # line 693, file: C:\xampp\smarty\libs\sysplugins\smarty_resource.php
Smarty_Template_Source.getCompiled(Object:Smarty_Internal_Template) # line 644, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.__get("compiled") # line 154, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch("index.tpl", null, null, null, true) # line 374, file: C:\xampp\smarty\libs\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.display("index.tpl") # line 10, file: C:\pichek\index.php


Any other suggestions? :/
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Apr 04, 2012 7:29 am    Post subject: Reply with quote

Whenever someone complains about filemtime() failing, muteExpectedErrors() should be the first reply
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
hafanka
Smarty n00b


Joined: 30 Mar 2012
Posts: 4

PostPosted: Fri Apr 06, 2012 9:59 pm    Post subject: Reply with quote

thank you! error was fixed Very Happy
Back to top
View user's profile Send private message
janaka007
Smarty n00b


Joined: 15 Apr 2012
Posts: 2

PostPosted: Sun Apr 15, 2012 11:16 am    Post subject: filemtime() stat failed for C:\tshirtshop\web roots......... Reply with quote

I am very new smarty Iam following Begining PHP and MySQL E-Commerce book and I got stuck in chapert 4 I install the smarty template
testing my files localy

I got this error

ERRNO: 2
TEXT: filemtime() [function.filemtime]: stat failed for C:\tshirtshop\web roots\Chapter 03\Code/presentation/templates_c\5e4c8fd69cb96c6bef822ccd49fd48542e36bc09.file.store_front.tpl.php
LOCATION: C:\tshirtshop\web roots\Chapter 03\Code\libs\smarty\sysplugins\smarty_resource.php, line 693, at April 15, 2012, 11:52 am
Showing backtrace:
filemtime("C:\tshirtshop\web roots\Chapter 03\Code/presentation/templates_c...") # line 693, file: C:\tshirtshop\web roots\Chapter 03\Code\libs\smarty\sysplugins\smarty_resource.php
Smarty_Template_Source.getCompiled(Object: Smarty_Internal_Template) # line 644, file: C:\tshirtshop\web roots\Chapter 03\Code\libs\smarty\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.__get("compiled") # line 154, file: C:\tshirtshop\web roots\Chapter 03\Code\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch("store_front.tpl", null, null, null, true) # line 374, file: C:\tshirtshop\web roots\Chapter 03\Code\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.display("store_front.tpl") # line 16, file: C:\tshirtshop\web roots\Chapter 03\Code\index.php


Can anybody help me on this I have been trying to resolve this problem for last 3 weeks so many google search but no luck PLEASE HELP.
Back to top
View user's profile Send private message
antanse
Smarty n00b


Joined: 02 Jul 2011
Posts: 2

PostPosted: Thu May 10, 2012 5:26 am    Post subject: could you tell me how you resolve this issue? Reply with quote

hafanka wrote:
thank you! error was fixed Very Happy
Back to top
View user's profile Send private message
Rikaelus
Smarty Rookie


Joined: 25 Feb 2005
Posts: 14

PostPosted: Sat May 26, 2012 9:51 am    Post subject: Reply with quote

rodneyrehm wrote:
Whenever someone complains about filemtime() failing, muteExpectedErrors() should be the first reply


I'm a little confused by this.

If these "errors" are generated but are that easy to dismiss as unimportant, shouldn't they be "muted" by default? Maybe enabled as an avenue of debugging?

Just seems odd for regular operations to generate such visible, plentiful "errors". And I feel kind of uncomfortable muting them immediately since I don't know what other *real* errors I might inadvertently be hiding.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat May 26, 2012 10:23 am    Post subject: Reply with quote

Normally these errors are suppressed by the '@' error suppression.

But if you register a custom error handler these errors are passed to your error handler. muteExpectedErrors() will filter out expected Smarty errors normally suppressed by '@' that they will not get to your custom error handler.
Back to top
View user's profile Send private message
deuce
Smarty n00b


Joined: 14 Nov 2012
Posts: 1

PostPosted: Wed Nov 14, 2012 1:59 pm    Post subject: Reply with quote

rodneyrehm wrote:
Whenever someone complains about filemtime() failing, muteExpectedErrors() should be the first reply


What did you meant by this?


Hi! I am trying to follow "Begining PHP and MySQL E-Commerce" book for creating a web site, and I got stuck with the smarty template. I work on my local machine on Windows.

I got this error


ERRNO: 2
TEXT: filemtime(): stat failed for C:\tshirtshop/presentation/templates_c\deca6ce1aa2ce0f97b6f150b062e149449e8946b.file.departments_list.tpl.php
LOCATION: C:\tshirtshop\libs\smarty\sysplugins\smarty_resource.php, line 720, at November 14, 2012, 2:51 pm
Showing backtrace:
filemtime("C:\tshirtshop/presentation/templates_c\deca6ce1aa2ce0f97b6f150b0...") # line 720, file: C:\tshirtshop\libs\smarty\sysplugins\smarty_resource.php
Smarty_Template_Source.getCompiled(Object: Smarty_Internal_Template) # line 654, file: C:\tshirtshop\libs\smarty\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.__get("compiled") # line 154, file: C:\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch(null, null, null, null, false, false, true) # line 286, file: C:\tshirtshop\libs\smarty\sysplugins\smarty_internal_template.php
Smarty_Internal_Template.getSubTemplate("departments_list.tpl", null, null, null, null, Array[0], "0") # line 49, file: C:\tshirtshop\presentation\templates_c\16c6394311bfc1ccfcfd573f10dee3f2facfd230.file.store_front.tpl.php
content_50a2cc402350b8_47734918(Object: Smarty_Internal_Template) # line 180, file: C:\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.fetch("store_front.tpl", null, null, null, true) # line 374, file: C:\tshirtshop\libs\smarty\sysplugins\smarty_internal_templatebase.php
Smarty_Internal_TemplateBase.display("store_front.tpl") # line 23, file: C:\tshirtshop\index.php

Can someone give me a hint? Thx!
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Nov 14, 2012 2:23 pm    Post subject: Reply with quote

deuce wrote:
Can someone give me a hint? Thx!


muteExpectedErrors()
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
sylo1987
Smarty n00b


Joined: 11 Jun 2014
Posts: 1

PostPosted: Wed Jun 11, 2014 9:22 am    Post subject: Re: could you tell me how you resolve this issue? Reply with quote

antanse wrote:
hafanka wrote:
thank you! error was fixed Very Happy


I've got an error of that kind I am stuck on my work whithout any posssibility to move forward. please tell me how you resolved it. Thank u god bless u
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Jun 11, 2014 8:30 pm    Post subject: Reply with quote

See http://www.smarty.net/docs/en/api.mute.expected.errors.tpl
Back to top
View user's profile Send private message
GeraldS
Smarty n00b


Joined: 29 Nov 2010
Posts: 4
Location: Darmstadt/Germany

PostPosted: Fri Aug 22, 2014 2:01 pm    Post subject: Reply with quote

Note that I got this error when I used my own error handler. After disabling my error handler Smarty worked again.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Aug 23, 2014 11:34 pm    Post subject: Reply with quote

You should insert
Code:
Smarty::muteExpectedErrors();

after your set_error_handler() call.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP