php代码中的open_basedir限制实际上是错误的 [英] open_basedir restriction in effect error in php code

查看:101
本文介绍了php代码中的open_basedir限制实际上是错误的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是php语言的初学者.在我的Web项目中,我创建了一个filepath.config.ini文件,该文件将所有文件路径存储在网站目录中.例如

Im beginner in php language. in my web project i created a filepath.config.ini file which stores all file path in the website directories. for eg.

CLASS1 = bin/myclass1.php
CLASS2 = bin/myclass2.php


并通过以下方式访问这些路径:


and im accessing those path by using:

require $_SERVER['DOCUMENT_ROOT'].'/'.GetfilePath('CLASS1');


在本地主机服务器上工作正常,并给我这样的路径


in localhost server its working good and giving me path like this

D:/myproject/bin/myclass1.php


当我将这些文件上传到测试服务器时,我收到此open_basedir限制错误.


when i upload those file on test server im getting this open_basedir restriction error.

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/projectfolder/bin/myclass1.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp)


我知道我们可以禁用此限制...但是我不知道该怎么做:P.
但是使用此服务器DOCUMENT_ROOT很好吗?
还是他们使用文件路径的任何其他方式?人们如何访问这些文件路径.
如果我禁用open_basedir限制会怎样?这样安全吗?
请帮我做什么?


i know we can disable this restriction...but i dont know how to do that :P.
but is it good to use this server DOCUMENT_ROOT ???
or is their any alternate way to use the file path? what you people do to access those file path.
and what happen if i disable the open_basedir restriction? is it secure to do that?
please help me what to do?

推荐答案

_SERVER [' DOCUMENT_ROOT'].' /' .GetfilePath( CLASS1');
_SERVER['DOCUMENT_ROOT'].'/'.GetfilePath('CLASS1');


在本地主机服务器上工作正常,并给我这样的路径


in localhost server its working good and giving me path like this

D:/myproject/bin/myclass1.php


当我将这些文件上传到测试服务器时,我收到此open_basedir限制错误.


when i upload those file on test server im getting this open_basedir restriction error.

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/projectfolder/bin/myclass1.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp)


我知道我们可以禁用此限制...但是我不知道该怎么做:P.
但是使用此服务器DOCUMENT_ROOT很好吗?
还是他们使用文件路径的任何其他方式?人们如何访问这些文件路径.
如果我禁用open_basedir限制会怎样?这样安全吗?
请帮我做什么?


i know we can disable this restriction...but i dont know how to do that :P.
but is it good to use this server DOCUMENT_ROOT ???
or is their any alternate way to use the file path? what you people do to access those file path.
and what happen if i disable the open_basedir restriction? is it secure to do that?
please help me what to do?


这篇关于php代码中的open_basedir限制实际上是错误的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆