kastin 发表于 2014-06-03 16:33

Function name must be a string in /usr/local/apache2/htdocs/INC/smarty/sysplugin

LAMP环境搭建完毕,测试phpinfo.php成功。
但是加载网站内容index.php时发生错误:
Fatal error: Function name must be a string in /usr/local/apache2/htdocs/INC/smarty/sysplugins/smarty_internal_templatebase.php on line 284

于是vim /usr/local/apache2/htdocs/INC/smarty/sysplugins/smarty_internal_templatebase.php
发现第284行是个注释:
274 ^M
275                         default:^M
276                           header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->c    ached->timestamp) . ' GMT');^M
277                           break;^M
278                     }^M
279                     echo $_output;^M
280               }^M
281             } else {^M
282               echo $_output;^M
283             }^M
284             // debug output^M
285             if ($this->smarty->debugging) {^M
286               Smarty_Internal_Debug::display_debug($this);^M
287             }^M
288             return;^M
289         } else {^M
290             // return fetched content^M
291             return $_output;^M
292         }^M
293   }^M
294 ^M
是代码问题吗?


另1:
发现/usr/local/apache2/htdocs/DAT/smarty/templates_c的权限为:
drwxrwxrwx 2 daemon daemon 4096 Jun3 16:04 templates_c
其他权限均为apache,不知是否有什么问题?

另2:
只要打开index.php就会在这个目录下生成一个文件:
-rw-r--r-- 1 daemon daemon 0 Jun3 16:04 c01a78cb5cdaf1718cadac99c902d522d26177cd.file.index.htm.php
打开发现是空的。
怀疑是不是权限问题,导致这个文件无法被写入或运行?

到底是代码问题、权限问题,还是LAMP环境跟网站内容原有架构某些地方不符?

kastin 发表于 2014-06-03 17:10

已解决,mark一下。
还是权限的问题。
chmod 777 /usr/local/apache2/htdocs/DAT/smarty/templates_c(该目录本来没有,手动建的。)
chmod 777 /usr/local/apache2/htdocs/DAT/smarty/cache
问题解决,网站index.php正常加载。
页: [1]
查看完整版本: Function name must be a string in /usr/local/apache2/htdocs/INC/smarty/sysplugin