简体   繁体   中英

open_basedir restriction in effect error in php code

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

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) 

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.ini文件( PHP:配置更改 )并禁用open_basedir或添加/ usr / local / apache / htdocs。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM