首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >php安装程序制作原理

php安装程序制作原理

作者头像
苦咖啡
发布于 2018-05-07 17:19:49
发布于 2018-05-07 17:19:49
2.7K0
举报
文章被收录于专栏:我的博客我的博客

过程: 1、(之前需要有安装协议)检查环境(操作系统、php版本、数据库、附件上传、目录权限、特殊环境要求(pdo、rewrtie、gd2、短标签等)) 2、基础数据输入(数据库服务器、数据库用户名、数据库密码、数据库名、数据库表前缀、初始管理员、初始管理员密码等) 3、检查配置文件是否正确、建立初始数据库、导入初始数据 4、删除或者移动安装文件(检测安装完全)

简单例子:

代码语言:javascript
复制
<?php
 $file="../data/config.php";//配置文件
 <span style="color: #ff0000;">if(is_writable($file))</span>
 {
  echo "配置文件可写入√";
 }else{
  echo "配置文件不可写入X";
}
 if(isset($_POST[‘sub’])){
 $str="<?php";
 $str.="\n";
 $str.="\$mysql_host=’".$_POST[‘host’]."’;";
 $str.="\n";
 $str.="\$mysql_user=’".$_POST[‘user’]."’;";
 $str.="\n";
 $str.="\$mysql_pass=’".$_POST[‘pass’]."’;";
 $str.="\n";
 $str.="\$mysql_db=’".$_POST[‘database’]."’;";
 $str.="\n";
 $str.="\$mysql_pre=’".$_POST[‘pre’]."’;";
 $str.="\n";
 $str.="?>";
 <span style="color: #ff0000;">$ff=fopen($file,"w+");</span>
 fwrite($ff,$str);
 }
 ?>
<form action="" method="post">
 主&nbsp;&nbsp;&nbsp;&nbsp;机:<input name="host" type="text" /><br />
用户名:<input name="user" type="text" /><br />
密&nbsp;&nbsp;&nbsp;&nbsp;码:<input name="pass" type="text" /><br />
数据库:<input name="database" type="text" /><br />
表前缀:<input name="pre" type="text" /><br />
<input name="sub" value="提交" type="submit" />
 </form>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2012年5月21日,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档