Cacti 版本: 0.8a

在安装好 cacti之后,进入Settings -> Paths, 而且里面的路径在系统中都存在的,在这里显示ERROR: FILE NOT FOUND

参考1的博文,是 php.ini 中打开了open_basedir,受这个配置的影响

打开php.ini文件,在open_basedir 前加; 进行注释,然后重启apache,再刷新 cacti 设置的路径页面,就会变成绿色的了。


也可以在httpd.conf中vhost文件中加

php_admin_flag engine ON
php_admin_value open_basedir /var/www/html/:/tmp:/var/tmp

关于open_basedir

它可将用户访问文件的活动范围限制在指定的区域,

假设open_basedir=/home/wwwroot/home/web1/:/tmp/,那么通过web1访问服务器的用户就无法获取服务器上除了/home/wwwroot/home/web1/和/tmp/这两个目录以外的文件。

注意用open_basedir指定的限制实际上是前缀,而不是目录名。

举例来说: 若"open_basedir = /dir/user", 那么目录 "/dir/user" 和 "/dir/user1"都是可以访问的。所以如果要将访问限制在仅为指定的目录,请用斜线结束路径名。

关于符号链接(软链接)

符号链接又叫软链接,是一类特殊的文件,这个文件包含了另一个文件的路径名(绝对路径或者相对路径)。

路径可以是任意文件或目录,可以链接不同文件系统的文件。在对符号文件进行读或写操作的时候,系统会自动把该操作转换为对源文件的操作,但删除链接文件时,系统仅仅删除链接文件,而不删除源文件本身。

在开启了open_basedir,使用软链接,将非open_basedir的文件软链接到这个目录,也是无法操作的

如:

我的open_basedir = /var/www/html/

touch /usr/bin/mytest.txt #创建一个open_basedir设定目录外的空文本文件
touch /var/www/html/mytest2.txt # 创建一个open_basedir设定目录内的空文本文件
ln -s /usr/bin/mytest.txt /var/www/html/mytest.txt #创建软链接
echo "<?php echo file_get_contents('/var/www/html/mytest.txt');" > /var/www/html/mytest.php #创建 mytest.php
echo "<?php echo file_get_contents('/var/www/html/mytest2.txt');" > /var/www/html/mytest2.php #创建 mytest2.php
php /var/www/html/mytest.php #执行php文件,运行结果:有提示错误
php /var/www/html/mytest2.php #执行php文件,运行结果:运行正常
References
  1. ltmp、lnmp下运行cacti监控path显示ERROR: FILE NOT FOUND
  2. PHP绕过open_basedir限制操作文件的方法
  3. open_basedir php授权目录设置

cacti ERROR: FILE NOT FOUND的更多相关文章

  1. 【gulp-sass】error: File to import not found or unreadable

    简要记录一下在使用gulp-sass时候踩的坑,虽然不明所以然,但是似乎在https://github.com/dlmanning/gulp-sass/issues/1 找到了答案. 在使用gulpf ...

  2. fatal error: file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Dev

    类似这样的错误: fatal error: file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.pla ...

  3. iOS 协同开发出fatal error: file ‘XX-Prefix.pch’ has been modified since the precompiled header was built

    在协同开发的时候,刚刚从svn下载到本地的代码,出现“fatal error: file 'XX-Prefix.pch' has been modified since the precompiled ...

  4. E514:write error(file system full?)

    vi编辑某文件,保存时报错,提示:E514: write error (file system full?)---写入错误,磁盘满了? 查看磁盘空间:df -h根目录磁盘空间已满,used%100. ...

  5. Transaction check error: file /etc/rpm/macros.ghc-srpm from install of redhat-rpm-config-9.1.0-80.el7.centos.noarch conflicts with file from package epel-release-6-8.noarch Error Summary ----------

    ./certbot-auto certonly 报错: Transaction check error:   file /etc/rpm/macros.ghc-srpm from install of ...

  6. Latex "Error: File ended while scanning use of \@xdblarge"

    Latex 编译时出现 Error: File ended while scanning use of \@xdblarge" 是因为少了一个 }...

  7. nodejs -- fs模块 ---> readFile 函数 1) fs.readFile(filename, "binary", function(error, file) 2) response.write(file, "binary");

    一:代码: 1.1 入口文件: index.js var server = require('./server'); var router = require("./router" ...

  8. Transaction Check Error:file /usr/libexec/getconf/default conflicts between attempted installs of gcc-6.4.1-1.fc25.i686 and gcc-6.4.1-1.fc25.x86_64

    今天在我的ubuntu系统上使用yum来安装软件时出错了错误:Transaction Check Error:file /usr/libexec/getconf/default conflicts b ...

  9. 《ArcGIS Runtime SDK for Android开发笔记》——问题集:Error:Error: File path too long on Windows, keep below 240 characters

    1.前言 在使用Android Studio开发环境时,经常会爆出以下错误,虽然具体细节内容各有不同,但是说明的都是同一个问题,在windows中使用过长的路径,超过240字符. Error:Erro ...

随机推荐

  1. Day 16 : Python 时间模块[time,]datetime[]及第三方模块的下载与安装

    在进行python程序开发时,除了可以使用python内置的标准模块外,还右许多第三方模块使用,可以在python官网找到. 在使用第三方模块时,需要下载并安装此模块,然后就可以使用标准模块一样导入并 ...

  2. 使用shell脚本查看文件类型

    显示文件类型 #如查看 /etc 目录 [root@localhost ~]# sh test.sh /etc /etc/ [目录文件] #如查看 /etc 目录下所有文件 [root@localho ...

  3. 高级UI晋升之常用View(三)中篇

    更多Android高级架构进阶视频学习请点击:https://space.bilibili.com/474380680本篇文章将从ViewPager来介绍常用View:文章目录 一.简介 二.基本使用 ...

  4. sanic连接mongo

    方法一: #没有密码,就是没有用户和用户密码 settings={"MOTOR_URI":"mongodb://127.0.0.1:27017/zzy"} ap ...

  5. context:component-scan报错

    文件头补上 xmlns:context=”http://www.springframework.org/schema/context” xsi:schemaLocation=”http://www.s ...

  6. CTF学习路线指南(附刷题练习网址)

    PWN,Reverse:偏重对汇编,逆向的理解: Gypto:偏重对数学,算法的深入学习: Web:偏重对技巧沉淀,快速搜索能力的挑战: Mic:则更为复杂,所有与计算机安全挑战有关的都算在其中 常规 ...

  7. 26.String类(1)

    1. 下面是一个使用equals的例子: 我查看了一下源代码,string类中equals方法的源代码如下: public boolean equals(Object anObject) { if ( ...

  8. 初始化workbook时可能忽略的问题

    正常情况下解析excel 先初始化workbook,使用文件名称后缀来初始化的. 一般情况下 这种是没有问题的,但是当遇到如果是07版本的 xlsx结尾的文件 改了后缀 为xls后 解析就会发生异常 ...

  9. JavaWeb学习篇之----容器Request详解

    前篇说到了Response容器对象,这篇我们就来看一下Request容器对象,之前也说过了,这个两个容器对象是相对应的,每次用户请求服务器的时候web容器就会给创建这对容器对象,他们是共存亡的,当然R ...

  10. BZOJ 1415: [Noi2005]聪聪和可可(记忆化搜索+期望)

    传送门 解题思路 还是比较简答的一道题.首先\(bfs\)把每个点到其他点的最短路求出来,然后再记忆化搜索.记搜的时候猫的走法是确定的,搜一下老鼠走法就行了. 代码 #include<iostr ...