<?php
$webmail_directory  = substr(dirname(__FILE__), 0, -3);
$smarty_main_directory = realpath($webmail_directory.'.\\smarty').'\\';
$smarty_compile_directory  = realpath($webmail_directory.'.\\Temp').'\\';
$smarty_template_dir  = realpath($webmail_directory.'.\\Themes').'\\';
$smarty_cache_dir  = realpath($webmail_directory.'.\\Cache').'\\';
$smarty_config_use_utf8 = true;
$smarty_enable_debug  = true;
$smarty_default_char_set  = "utf-8";
$smarty_enable_caching      = false;$webmail_server_debug = true;
?><?php
require_once($smarty_main_directory."Smarty.class.php");
//输出来$smarty_main_directory."Smarty.class.php"此文件的路径是正确的
//require_once("../Smarty/Smarty.class.php");
$smarty  = new Smarty;
$smarty->security = false;
$smarty->secure_dir  = array("./");
$smarty->config_dir  = "./";
$smarty->compile_dir  = $smarty_compile_directory;
$smarty->template_dir  = $smarty_template_dir;
$smarty->cache_dir  = $smarty_cache_dir;$smarty->debugging = $smarty_enable_debug;
$smarty->caching = $smarty_enable_caching; //设置缓存方式$smarty->left_delimiter   = "{"; 
$smarty->right_delimiter  = "}";
$smarty->config_use_utf8  = $smarty_config_use_utf8;
$smarty->config_file_charset= $smarty_default_char_set;
//$smarty->assign("LanguageFile", $selected_common_language);
//$smarty->assign("CustomerLanguageFile", $selected_customer_language);
//$smarty->assign("PageCharset", $page_charset);
?>用到了两个虚以站点
用着用着就出现了这样的错误提示:重启Apache之后才正常,多次点击之后又出现了下面的错误
Fatal error: Class 'Smarty' not found in D:\MuseMail\webmail\phpdocs\Inc\lib.smarty.php on line 4

解决方案 »

  1.   

    嘿嘿,有的时候并不一定是你的smarty的问题,有可能你装了ZEND或者别的公司的产品出现的,我就碰到过,还是到国外找到的答案解决的
      

  2.   

    Class Smarty是在Smarty.class.php文件当中,你这个怎么会去lib.smarty.php中找Smarty
      

  3.   

    lib.smarty.php 文件中包含了Smarty.class.php如下:require_once($smarty_main_directory."Smarty.class.php"); 
    //输出来$smarty_main_directory."Smarty.class.php"此文件的路径是正确的 
    //require_once("../Smarty/Smarty.class.php"); 
    $smarty = new Smarty; 
      

  4.   

    用ini_set();将smarty路径加到include_path里面去,
    这样可以避免你的路径搞错.
      

  5.   

    lz试试这种路径,表用变量判断
    $smarty_template_dir = "c:\dir\dir";
      

  6.   

    $smarty_main_directory的路径放在include_path里面
      

  7.   

    试过了不行开始是正常的,多点了几下就出现Fatal error: Class 'Smarty' not found in D:\MuseMail\webmail\phpdocs\Inc\lib.smarty.php on line 4 这个错误[Thu Apr 23 10:02:35 2009] [apc-error] Cannot redeclare class smarty
    [Thu Apr 23 10:02:35 2009] [crit] Parent: child process exited with status 2 -- Aborting.
    这是Apache错误日志
      

  8.   

    此问题搞得我郁闷死了将程序拷到phpNow 下可以正常运行,自己手动配置的Apache + PHP就出现这鸟问题http://www.zs-shepotak.com/conf.rar
    这是php.ini conf.cfg 文件请各位大哥大姐帮忙看一下,问题出在那里
      

  9.   

    require_once($smarty_main_directory."Smarty.class.php"); 如果你正确设定include_path,require_once("Smarty.class.php");就可以了。理解官方文档!
      

  10.   

    include_path 没有设定以下是错误日志,请各位帮忙[Thu Apr 23 13:42:43 2009] [warn] pid file D:/MuseMail/webmail/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    [Thu Apr 23 13:42:44 2009] [notice] Apache/2.2.9 (Win32) PHP/5.2.5 configured -- resuming normal operations
    [Thu Apr 23 13:42:44 2009] [notice] Server built: Jun 13 2008 04:04:59
    [Thu Apr 23 13:42:44 2009] [notice] Parent: Created child process 3172
    [Thu Apr 23 13:42:44 2009] [notice] Child 3172: Child process is running
    [Thu Apr 23 13:42:44 2009] [notice] Child 3172: Acquired the start mutex.
    [Thu Apr 23 13:42:44 2009] [notice] Child 3172: Starting 64 worker threads.
    [Thu Apr 23 13:42:44 2009] [notice] Child 3172: Starting thread to listen on port 8338.
    [Thu Apr 23 13:42:44 2009] [notice] Child 3172: Starting thread to listen on port 80.
    [Thu Apr 23 13:44:54 2009] [notice] Parent: Received shutdown signal -- Shutting down the server.
    [Thu Apr 23 13:44:54 2009] [notice] Child 3172: Exit event signaled. Child process is ending.
    [Thu Apr 23 13:44:55 2009] [notice] Child 3172: Released the start mutex
    [Thu Apr 23 13:44:56 2009] [notice] Child 3172: All worker threads have exited.
    [Thu Apr 23 13:44:56 2009] [notice] Child 3172: Child process is exiting
    [Thu Apr 23 13:44:56 2009] [notice] Parent: Child process exited successfully.
    [Thu Apr 23 13:44:57 2009] [notice] Apache/2.2.9 (Win32) PHP/5.2.5 configured -- resuming normal operations
    [Thu Apr 23 13:44:57 2009] [notice] Server built: Jun 13 2008 04:04:59
    [Thu Apr 23 13:44:57 2009] [notice] Parent: Created child process 4996
    [Thu Apr 23 13:44:57 2009] [notice] Child 4996: Child process is running
    [Thu Apr 23 13:44:57 2009] [notice] Child 4996: Acquired the start mutex.
    [Thu Apr 23 13:44:57 2009] [notice] Child 4996: Starting 64 worker threads.
    [Thu Apr 23 13:44:57 2009] [notice] Child 4996: Starting thread to listen on port 8338.
    [Thu Apr 23 13:44:57 2009] [notice] Child 4996: Starting thread to listen on port 80.
    [Thu Apr 23 13:45:20 2009] [apc-error] Cannot redeclare class smarty
    [Thu Apr 23 13:45:20 2009] [crit] Parent: child process exited with status 2 -- Aborting.
    [Thu Apr 23 13:45:40 2009] [notice] Apache/2.2.9 (Win32) PHP/5.2.5 configured -- resuming normal operations
    [Thu Apr 23 13:45:40 2009] [notice] Server built: Jun 13 2008 04:04:59
    [Thu Apr 23 13:45:40 2009] [notice] Parent: Created child process 704
    [Thu Apr 23 13:45:41 2009] [notice] Child 704: Child process is running
    [Thu Apr 23 13:45:41 2009] [notice] Child 704: Acquired the start mutex.
    [Thu Apr 23 13:45:41 2009] [notice] Child 704: Starting 64 worker threads.
    [Thu Apr 23 13:45:41 2009] [notice] Child 704: Starting thread to listen on port 8338.
    [Thu Apr 23 13:45:41 2009] [notice] Child 704: Starting thread to listen on port 80.
      

  11.   

    [apc-error] Cannot redeclare class smarty extension=php_apc.dll   加载了这一行就会出问题