PHP致命错误:require()

PHP致命错误:require(),php,web,smarty,host,Php,Web,Smarty,Host,我有一个网站,在我的本地主机与xampp完美地工作,但。。。我把它上传到了一些免费的网站(000webhost和hostinger),当我试图打开它时,收到了以下消息: 警告:require(core/libs/smarty/smarty.class.php):无法打开流:第7行的/home/u327900732/public_html/www/index.php中没有此类文件或目录 致命错误:require():无法在/home/u327900732/public\u html/www/ind

我有一个网站,在我的本地主机与xampp完美地工作,但。。。我把它上传到了一些免费的网站(000webhost和hostinger),当我试图打开它时,收到了以下消息:

警告:require(core/libs/smarty/smarty.class.php):无法打开流:第7行的/home/u327900732/public_html/www/index.php中没有此类文件或目录

致命错误:require():无法在/home/u327900732/public\u html/www/index.php第7行打开所需的“core/libs/smarty/smarty.class.php”(include_path=”。:/opt/php-5.5/pear)

代码如下:


我检查了那个文件一百次,它就在那里

我找到并尝试了以下解决方案:

  • 变更要求包括:
警告:include(core/libs/smarty/smarty.class.php):无法打开流:第7行的/home/u327900732/public_html/www/index.php中没有此类文件或目录

警告:include():在第7行的/home/u327900732/public_html/www/index.php中打开“core/libs/smarty/smarty.class.php”以包含(include_path=':/opt/php-5.5/pear')失败

致命错误:在第3行的/home/u327900732/public_html/www/core/controllers/indexController.php中找不到类“Smarty”

  • require(chdir(dirname(文件)。'core/libs/smarty/smarty.class.php')
警告:require(1core/libs/smarty/smarty.class.php):无法打开流:第7行的/home/u327900732/public_html/www/index.php中没有此类文件或目录

致命错误:require():无法在第7行打开/home/u327900732/public_html/www/index.php中所需的'1core/libs/smarty/smarty.class.php'(include_path=':/opt/php-5.5/pear')

  • 将第7行更改为
    需要_once($_SERVER['DOCUMENT_ROOT']./core/libs/smarty/smarty.class.php')
警告:require_once(/home/u327900732/public_html/core/libs/smarty/smarty.class.php):无法打开流:第7行的/home/u327900732/public_html/www/index.php中没有此类文件或目录

致命错误:require_once():在第7行/home/u327900732/public_html/core/libs/smarty/smarty.class.php(include_path=.:/opt/php-5.5/pear)中打开所需的“/home/u327900732/public_html/www/index.php”失败


我尝试将“/”添加到路径中,但仍然不起作用。我再说一遍,这个网站在我的本地主机上运行得非常好。救命啊

尝试使用完整的url来测试您的url。或在浏览器中检查文件是否存在。就像这里:


我认为显示文件不存在时会显示错误。

服务器上是否有必需的(Smarty)文件?如果文件实际位于服务器上,则可能需要通过其位于服务器上的核心路径进行访问。类似于
require_once($_SERVER['DOCUMENT_ROOT'..]./core/libs/smarty/smarty.class.php')将起作用。您可能需要根据目录设计进行调整。@user2182349 Smarty文件在我的主文件夹中,我已将完整的主文件夹上载到服务器。@camelCase谢谢,但它不起作用,我用您的想法及其结果编辑了这篇文章。您指的是主文件夹中的文件,您的主文件夹是否在
www
文件夹中?换句话说,如果将
www
添加到
/core/libs/…
之前,它会工作吗?