我需要操作openldap服务器数据库文件以获取应用功能。我注意到在shell上它可以找到openldap数据库文件olcDatabase = {1} bdb.ldif。但是当我从Windows主机从Web浏览器运行脚本时,它找不到该文件。所以我写了我的测试脚本如下。
<?php
$filename = '/etc/openldap/slapd.d/cn=config/olcDatabase={1}bdb.ldif';
file_put_contents('/var/log/file_path_data', realpath($filename));
if (file_exists($filename))
echo "find the file";
else
echo "don't find the file";
?>
当它从网络运行时,它根本无法找到该文件而转义特殊字符并没有帮助。我还使用%3D或\ x3D来替换&#34; =&#34;例如,在文件路径中(参见http://www.ascii-code.com/),但它也没有帮助。当无法找到文件时,网络浏览器中没有任何单一错误报告。
这可能与windows环境中的utf8编码或类似的东西有关,但我无法弄清楚如何解决这个问题。高度赞赏任何提示和解决方案。非常感谢提前!
答案 0 :(得分:-1)
首先尝试从较少的子目录中读取您的文件。 当您发现什么是字符时,您的Web服务器无法处理
例如,创建此测试文件:
1)$ filename ='/ etc / openldap / slad.d / olcDatabase = {1} bdb.ldif';
2)$ filename ='/ etc / openldap / slad.d / olcDatabase = bdb.ldif';
尝试阅读