likeadmin(PHP-SaaS版本) 系统框架 网址(https://www.likeadmin.cn/) 在 SAAS 平台-代码生成器里生成代码报错 is_dir(): open_basedir restriction in effect. File(/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/src/api/) is not within the allowed path(s): (/home/www/local.chineseherb.cn/likeadmin_php_saas-master/server/:/tmp/)
likeadmin(PHP-SaaS版本) 系统框架 网址(https://www.likeadmin.cn/) 在 SAAS 平台-代码生成器里生成代码报错 is_dir(): open_basedir restriction in effect. File(/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/src/api/) is not within the allowed path(s): (/home/www/local.chineseherb.cn/likeadmin_php_saas-master/server/:/tmp/)
likeadmin(PHP-SaaS版本) 系统框架 网址(https://www.likeadmin.cn/) 在 SAAS 平台-代码生成器里生成代码报错 is_dir(): open_basedir restriction in effect. File(/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/src/api/) is not within the allowed path(s): (/home/www/local.chineseherb.cn/likeadmin_php_saas-master/server/:/tmp/)

用户545179374
01月04日
|
浏览 44
后端
前端
程序员
开发编程
该错误是由于PHP的open_basedir安全限制导致。生成器试图访问的目录不在允许的路径列表中。
解决方案:
-
检查并修改
open_basedir配置- 找到你的PHP配置文件(如
php.ini)。 - 搜索
open_basedir指令。 - 将报错中需要访问的目录路径(
/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/src/api/)添加到允许的路径列表中。多个路径用冒号分隔。 - 修改后重启PHP服务(如PHP-FPM或Apache)。
示例修改:
将原来的:复制代码open_basedir = /home/www/local.chineseherb.cn/likeadmin_php_saas-master/server/:/tmp/修改为:
复制代码open_basedir = /home/www/local.chineseherb.cn/likeadmin_php_saas-master/server/:/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/:/tmp/(建议包含整个
admin目录,而不仅是api子目录,以确保其他相关操作正常。) - 找到你的PHP配置文件(如
-
临时在代码中设置(不推荐用于生产环境)
如果无法修改全局配置,可以在生成器执行的入口文件(通常是server/public/index.php)顶部添加:复制代码ini_set('open_basedir', '/home/www/local.chineseherb.cn/likeadmin_php_saas-master/server/:/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/:/tmp/'); -
检查目录权限
确保Web服务器进程(如www-data或nginx用户)对/home/www/local.chineseherb.cn/likeadmin_php_saas-master/admin/src/api/目录有读写权限。
主要原因: SAAS版代码生成器需要将生成的代码文件写入到 admin 应用目录,而默认的 open_basedir 配置只允许访问 server 目录。
请通过【🔍追问按钮】发送完整错误截图
我要提问
复制内容
分享给好友
AI编程问答网 免责声明:
以上内容除特别注明外均来源于网友提问,AI编程问答网回答,权益归原著者所有;
