Php 无法打开流:没有这样的文件或目录
我现在将我的项目上传到digital ocean中的服务器,但我在apache2错误日志中得到了这个错误 require_once(/var/www/html/example/v1../include/DbHandler.php):失败 打开流:没有这样的文件或目录 发生错误的2行是这样的,在localhost中运行良好,但当转到服务器时,它会出现上述错误Php 无法打开流:没有这样的文件或目录,php,apache,filestream,digital-ocean,Php,Apache,Filestream,Digital Ocean,我现在将我的项目上传到digital ocean中的服务器,但我在apache2错误日志中得到了这个错误 require_once(/var/www/html/example/v1../include/DbHandler.php):失败 打开流:没有这样的文件或目录 发生错误的2行是这样的,在localhost中运行良好,但当转到服务器时,它会出现上述错误 require_once '../include/DBHandler.php'; require_once '../include/Pass
require_once '../include/DBHandler.php';
require_once '../include/PassHash.php';
我的目录如下,我需要DBhandler.php
,它位于include
文件夹中,index.php
来自v1
文件夹(需要调用一次的地方)
这是我得到的错误日志
[Fri May 19 12:33:19.621030 2017][:error][pid 5236][client 115.133.247.14:575 22]PHP警告:需要一次(/var/www/html/example/v1../include/DbHandler.php):无法打开流:第9行的/var/www/htm l/example/v1/index.php中没有此类文件或目录
我到目前为止所做的尝试
require_once$_SERVER['DOCUMENT_ROOT']./include/DBHandler.php';
需要_once$_服务器['DOCUMENT_ROOT']./include/PassHash.php';
这一切都不能解决问题
require_once __DIR__."/../include/DBHandler.php";
require_once __DIR__."/../include/PassHash.php";
有人请帮忙!给我一个正确的方向,这样我就可以继续了可能是您的文件名案例:DBHandler intead of DBHandler您需要:
require_once '../include/DbHandler.php';
您的文件名:
DBhandler.php
名字不一样。
将您的要求更改为:
require_once '../include/DBHandler.php';
只要删除文件路径上的符号/此图标,您的问题就会得到解决
require_once(var/www/html/example/v1../include/DbHandler.php):无法打开流:没有这样的文件或目录yopu在您的include中有caps,但您的dbhandler文件名是小写的/../include/dbhandler.php
与-dbhandler.php
不匹配,我在服务器的文件中更改为dbhandler.php,但它仍然有500内部错误
先生,我更改为require\u一次“../include/DBHandler.php”;
但问题仍然相同。还有其他原因吗?先生,我将更改为“require_once”../include/DBHandler.php
”;但问题仍然相同。还有其他原因吗?删除/
符号无法解决问题。因此这不是答案
require_once '../include/DBHandler.php';