PHP and Smarty: filemtime(): stat failed

强颜欢笑 提交于 2020-01-05 10:26:50

问题


I am getting the following error filemtime(): stat failed.

The full error is:

ERRNO: 2 TEXT: filemtime(): stat failed for C:\hatshop/presentation//templates_c\74b952bedd7366ad261e8be04bc5be8ef15c2fc1.file.departments_list.tpl.php LOCATION: C:\hatshop\libs\smarty\sysplugins\smarty_resource.php, line 720, at March 30, 2013, 12:14 am Showing backtrace: filemtime("C:\hatshop/presentation//templates_c\74b952bedd7366ad261e8be04bc...") # line 720, file: C:\hatshop\libs\smarty\sysplugins\smarty_resource.php Smarty_Template_Source.getCompiled(Object: Smarty_Internal_Template) # line 654, file: C:\hatshop\libs\smarty\sysplugins\smarty_internal_template.php Smarty_Internal_Template.__get("compiled") # line 154, file: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.fetch(null, null, null, null, false, false, true) # line 286, file: C:\hatshop\libs\smarty\sysplugins\smarty_internal_template.php Smarty_Internal_Template.getSubTemplate("departments_list.tpl", null, null, null, null, Array[0], "0") # line 34, file: C:\hatshop\presentation\templates_c\3522bf5c12e26ac546fbfc3693da6da22f71f1d6.file.index.tpl.php content_5155dc5df33599_26514511(Object: Smarty_Internal_Template) # line 180, file: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.fetch("index.tpl", null, null, null, true) # line 374, file: C:\hatshop\libs\smarty\sysplugins\smarty_internal_templatebase.php Smarty_Internal_TemplateBase.display("index.tpl") # line 7, file: C:\hatshop\index.php

I have read many posts on this problem but most of them are not clear how to apply the solution, they just suggest things in a very unclear way.


回答1:


i had the same error solved it by adding:

$this->error_reporting = E_ALL & ~E_NOTICE;
$this->muteExpectedErrors();

to my application.php

<?php

// Reference Smarty library
require_once SMARTY_DIR . 'Smarty.class.php';

/* Class that extends Smarty, used to process and display Smarty
  files */

class Application extends Smarty {

    // Class constructor
    public function __construct() {
        // Call Smarty's constructor
        parent::__construct();

       $this->error_reporting = E_ALL & ~E_NOTICE;
       $this->muteExpectedErrors();

        // Change the default template directories
        $this->template_dir = TEMPLATE_DIR;
        $this->compile_dir = COMPILE_DIR;
        $this->config_dir = CONFIG_DIR;
        $this->addPluginsDir(SMARTY_DIR . 'plugins');
        $this->addPluginsDir(PRESENTATION_DIR . 'smarty_plugins');
    }

}

?>

do check this link:

http://www.smarty.net/forums/viewtopic.php?t=21352&sid=88c6bbab5fb1fd84d3e4f18857d3d10e




回答2:


I have also seen this kind of error , I think it is related to file permission set in the smarty folders like template_c . Because Smarty to try to determine if we can use the Cached file or not and try to get the file Time. Please check your process is having correct set of permission on the folders




回答3:


This happens when registered stream wrapper class has no defined url_stat method. It's unclear in the documentation but this method is required by PHP stat cache.



来源:https://stackoverflow.com/questions/15713414/php-and-smarty-filemtime-stat-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!