解决宝塔系统php中 include(): open_basedir restriction in effect. File错误问题。
解决宝塔系统php中 include(): open_basedir restriction in effect. File错误问题。
include(): open_basedir restriction in effect. File()is not within the allowed path(s)
今天在用宝塔时php中出现这个问题:include(): open_basedir restriction in effect. File()is not within the allowed path(s)
源代码是:
include("../data_abxxxx/common.inc.php");//加载配置文件
运行错:
include(): open_basedir restriction in effect. File(......)is not within the allowed path(s)
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /www/wwwroot/cn.php on line 2
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in /www/wwwroot//cn.php on line 2
Database Server Password Error!
上面的代码出现问题,两个意思。
1、不能进行include文件,没有权限
2、mysql不能用了,需要用mysqli或pdo才行。
解决办法
1、如果是宝塔系统,直接在对应的网站管理中,找到网站目录-把 防跨站攻击(open_basedir) 取消选中即可。
2、问题2要用低版本的php都可以,比如php5.3或php5.6以下版本,因为高版本的php已经不再使用mysql_connect这种连接了。
本文由设计学习网整理发布,不代表设计学习网立场,转载联系作者并注明出处:https://ffjianzhan.cn/wangjs/qianduan/12691.html