您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Ln建立的软链接文件夹中的文件无法require

2024/2/21 8:18:19发布44次查看
一个网站中的文件夹要在同服务器的另一个网站中有用到,不想来回复制麻烦,试着用ln -s命令在另一个网站项目下生成软链接,然后发现无法require。自己阿里云上测试一下却可以,请问是怎么回事?
错误提示是:
warning: require_once(): open_basedir restriction in effect. file(/www/web/jyamd/system/db_config.php) is not within the allowed path(s): (/www/web/jycf:/tmp) in /www/web/jycf/public/test.php on line 4warning: require_once(/www/web/jyamd/system/db_config.php): failed to open stream: operation not permitted in /www/web/jycf/public/test.php on line 4fatal error: require_once(): failed opening required '../system/db_config.php' (include_path='.:/www/wdlinux/apache_php-5.4.26/lib/php') in /www/web/jycf/public/test.php on line 4

回复内容: 一个网站中的文件夹要在同服务器的另一个网站中有用到,不想来回复制麻烦,试着用ln -s命令在另一个网站项目下生成软链接,然后发现无法require。自己阿里云上测试一下却可以,请问是怎么回事?
错误提示是:
warning: require_once(): open_basedir restriction in effect. file(/www/web/jyamd/system/db_config.php) is not within the allowed path(s): (/www/web/jycf:/tmp) in /www/web/jycf/public/test.php on line 4warning: require_once(/www/web/jyamd/system/db_config.php): failed to open stream: operation not permitted in /www/web/jycf/public/test.php on line 4fatal error: require_once(): failed opening required '../system/db_config.php' (include_path='.:/www/wdlinux/apache_php-5.4.26/lib/php') in /www/web/jycf/public/test.php on line 4

先看require报错,估计是文件权限
自己解决了,出错的原因是我们用了虚拟主机管理软件wdcp,这个软件在网站的vhosts.conf里自动加了目录限制。
找到网站的这一段,把目录限制改为:
php_admin_value open_basedir /www/web
就可以了。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product