true,"msg"=>"找不到mysql.sql"]); exit(); } $sqlSource = file_get_contents('../mysql.sql'); $sqlSource = str_replace("https://cloudreve.org/", $_POST["siteUrl"], $sqlSource); $mysqli = @new \mysqli($_POST["mysqlServer"], $_POST["mysqlUser"], $_POST["mysqlPwd"], $_POST["mysqlDb"], (int)$_POST["mysqlPort"]); if ($mysqli->connect_error) { @$mysqli->close(); echo json_encode(["error"=>true,"msg"=>$mysqli->connect_error]); exit(); } if (!$mysqli->multi_query($sqlSource)) { echo json_encode(["error"=>true,"msg"=>"无法写入数据表"]); exit(); } if(file_exists('../application/database.php')){ echo json_encode(["error"=>true,"msg"=>"application/database.php 已存在,请备份并删除后再试"]); exit(); } try { $fileContent = file_get_contents("database_sample.php"); $replacement = array( '{hostname}' => $_POST["mysqlServer"], '{database}' => $_POST["mysqlDb"], '{username}' => $_POST["mysqlUser"], '{password}' => $_POST["mysqlPwd"], '{hostport}' => $_POST["mysqlPort"], ); $fileContent = strtr($fileContent,$replacement); file_put_contents('../application/database.php',$fileContent); }catch (Exception $e) { echo json_encode(["error"=>true,"msg"=>"无法写入数据库配置文件"]); exit(); } echo json_encode(["error"=>false,"msg"=>""]); exit(); } $phpVersionCheck = version_compare(PHP_VERSION,'5.6.0', '>'); $success = ' 满足'; $error = ' 不满足'; $runtimeDirCheck = is_writable("../runtime"); $applicationDirCheck = is_writable("../application"); $publicDownloadsDirCheck = is_writable("../public/downloads"); $publicAvatarsDirCheck = is_writable("../public/avatars"); $publicThumbDirCheck = is_writable("../public/thumb"); $publicUploadsDirCheck = is_writable("../public/uploads"); $publicUploadsChunksDirCheck = is_writable("../public/uploads/chunks"); $curlCheck = extension_loaded("curl"); $pdoCheck = extension_loaded("pdo"); $fileinfoCheck = extension_loaded("fileinfo"); $gdCheck = extension_loaded("gd"); $thinkCaptchaCheck = is_dir("../vendor/topthink/think-captcha"); $ossCheck = is_dir("../vendor/aliyuncs/oss-sdk-php"); $davCheck = is_dir("../vendor/sabre/dav"); $upyunCheck = is_dir("../vendor/upyun/sdk"); $googleauthenticatorCheck = is_dir("../vendor/phpgangsta/googleauthenticator"); $qrcodeCheck = is_dir("../vendor/endroid/qrcode"); $isOk = $phpVersionCheck && $runtimeDirCheck && $applicationDirCheck && $publicAvatarsDirCheck && $curlCheck && $pdoCheck && $fileinfoCheck; ?> 安装向导- Cloudreve

环境检查


基本环境
>
# 项目 说明 必要性 当前 状态
1 PHP版本 >= 5.6 满足Cloudreve基本需求的最低PHP版本为5.6 必须
2 URL Rewrite 服务器需正确配置URL重写规则(伪静态),否则各个页面将会返回404错误 必须
读写权限
> > > > > >
# 目录 说明 必要性 状态
1 runtime 可读写 runtime用于存放系统工作产生的临时文件、日志、缓存等数据 必须
2 application 可读写 application用于安装程序写入数据库配置文件,仅安装时需要写入权限 必须(临时)
3 public/avatars 可读写 用于存放用户头像 必须
4 public/uploads 可读写 用于存放本地策略上传的文件数据 可选
5 public/uploads/chunks 可读写 用于存放本地策略上传文件的临时分片数据 可选
6 public/downloads 可读写 用于存放离线下载的文件数据 可选
PHP扩展
> > > >
# 扩展名 说明 必要性 状态
1 curl 发送网络请求 必须
2 pdo 数据库操作 必须
3 fileinfo 用于处理本地策略图像文件预览、用户头像展示 推荐
4 gd 用于生成验证码 推荐
依赖库
> > > > > >
# 库名 说明 必要性 状态
1 think-captcha 生成验证码图像 可选
2 oss-sdk-php 阿里云OSS上传策略需要使用 可选
3 dav WebDAV功能需要使用 可选
4 upyun/sdk 又拍云上传策略需要使用 可选
5 googleauthenticator 二步验证 可选
5 endroid/qrcode 用于生成二步验证的二维码 可选