为什么我的网站没有加载而是出现此错误-“聪明:无法写入文件”?

问题描述 投票:0回答:1

完整的错误消息是:

Fatal error: Uncaught --> Smarty: unable to write file /var/www/html/cache/smarty/compile/9d/fc/13/wrt5df05326c094e8_21248361 <-- thrown in /var/www/html/tools/smarty/sysplugins/smarty_internal_write_file.php on line 46

我已经清除了“ / var / www / html / cache / smarty / compile /”目录,而“ / var / www / html / cache / smarty / cache”目录只有一个“ index.php”文件(人们也建议清除此目录)。

我已经将这两个目录(甚至是递归地)以及smarty_internal_write_file.php的权限都设置为777。

我已经检查了驱动器上是否有足够的空间。还清除了Chrome缓存/尝试了其他浏览器。

我上次尝试访问此站点的时间是2-3个月前,没有任何问题。我们的网站托管在AWS上的ubuntu EC2实例上。

我读过某个地方的答案,建议如果以上方法无效,请与服务器主机管理员联系,但我不确定在这种情况下他们将如何提供帮助。

php amazon-web-services ubuntu prestashop smarty
1个回答
0
投票

您是否还编写脚本来创建必要的文件夹?它们存在吗?

如果您只有/ var / www / html / cache / smarty / compile /,然后要求脚本写入/ var / www / html / cache / smarty / compile / 9d / fc / 13 /名为wrt5df05326c094e8_21248361的文件,则还需要先创建/ 9d,然后创建/ fc/ 13

甚至fopen中的选项w +都不会递归地创建3个目录。

chmod(777)存在安全风险,您应该将文件丢给网络用户。

© www.soinside.com 2019 - 2024. All rights reserved.