Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过php找不到.conf_Php_Linux - Fatal编程技术网

通过php找不到.conf

通过php找不到.conf,php,linux,Php,Linux,我试图在linux上读取/var/www/myDir下的a.conf文件 这是密码 $confFile = "vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } 上面说找不到文件。知道为什么吗> 谢谢 Jean给出完整路径 $confFile = "/var/www/myD

我试图在linux上读取/var/www/myDir下的a.conf文件

这是密码

$confFile = "vhost.conf";
if (file_exists($confFile)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
上面说找不到文件。知道为什么吗>

谢谢 Jean

给出完整路径

$confFile = "/var/www/myDir/vhost.conf";
给出完整的路径

$confFile = "/var/www/myDir/vhost.conf";

您的脚本是否在同一路径中执行?否则,请尝试使用完整路径

if (file_exists('/var/www/myDir'. $confFile)) {

…脚本是否在同一路径中执行?否则,请尝试使用完整路径

if (file_exists('/var/www/myDir'. $confFile)) {

尝试使用绝对路径,如下所示:

$confFile = $_SERVER['DOCUMENT_ROOT'] . "/vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } $confFile=$\u服务器['DOCUMENT\u ROOT']。“/vhost.conf”; 如果(文件_存在($confFile)){ 回显“文件$filename存在”; }否则{ 回显“文件$filename不存在”; } 或者可能是这样:

$confFile = "/var/www/myDir/vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } $confFile=“/var/www/myDir/vhost.conf”; 如果(文件_存在($confFile)){ 回显“文件$filename存在”; }否则{ 回显“文件$filename不存在”; }
尝试使用绝对路径,如下所示:

$confFile = $_SERVER['DOCUMENT_ROOT'] . "/vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } $confFile=$\u服务器['DOCUMENT\u ROOT']。“/vhost.conf”; 如果(文件_存在($confFile)){ 回显“文件$filename存在”; }否则{ 回显“文件$filename不存在”; } 或者可能是这样:

$confFile = "/var/www/myDir/vhost.conf"; if (file_exists($confFile)) { echo "The file $filename exists"; } else { echo "The file $filename does not exist"; } $confFile=“/var/www/myDir/vhost.conf”; 如果(文件_存在($confFile)){ 回显“文件$filename存在”; }否则{ 回显“文件$filename不存在”; }
@琼:嗯。。如何获取未找到消息应该是
文件存在
文件不存在
@Jean:hummm。。如何获取未找到消息应该是
文件存在
文件不存在
该死!是否尝试为测试目的授予您的
myDir
全局读/写权限?如果可行,请尝试不同的权限组合,以获得所需的安全性和功能。这是一个很长的机会,但它可能会工作:-)该死!是否尝试为测试目的授予您的
myDir
全局读/写权限?如果可行,请尝试不同的权限组合,以获得所需的安全性和功能。这是一个很长的机会,但它可能会起作用:-)