设为首页 加入收藏

TOP

PHP_环境配置_python脚本_2017(二)
2017-10-10 11:33:05 】 浏览:10122
Tags:PHP_ 环境 配置 _python 脚本 _2017
quot;
.").replace("\\","/") + "/php/php.ini", "w") for line in f5: if '''extension_dir = "ext"''' in line: line = """extension_dir = "ext"\n""" elif """;extension=php_mysql.dll""" in line: line = """extension=php_mysql.dll\n""" elif """;extension=php_mysqli.dll""" in line: line = """extension=php_mysqli.dll\n""" elif """;extension=php_pdo_mysql.dll""" in line: line = """extension=php_pdo_mysql.dll\n""" else: line = line f6.write(line) f6.close() f3 = open(os.path.abspath(".").replace("\\","/") + "/mysql/my-default.ini", "r").readlines() f4 = open(os.path.abspath(".").replace("\\","/") + "/mysql/my.ini", "w") for line in f3: if "basedir" in line: line = "basedir = %s\n" % (os.path.abspath(".").replace("\\","/") + "/mysql") elif "datadir" in line: line = "datadir = %s\n" % (os.path.abspath(".").replace("\\","/") + "/mysql/data") elif "port" in line: line = "port = 3306\n" else: line = line f4.write(line) f4.write("""# 服务端的编码方式 character-set-server = utf8 [client] #客户端编码方式,最好和服务端保存一致 loose-default-character-set = utf8""") f4.close() s = os.path.abspath(".").replace("\\","/") + "/mysql/bin/mysqld.exe --remove mysql" os.system(s) s = os.path.abspath(".").replace("\\","/") + "/mysql/bin/mysqld.exe --install mysql" os.system(s) os.system("net stop mysql & net start mysql & pause") if os.path.exists(pathname + "/conf/httpd.conf.bak"): os.remove(pathname + "/conf/httpd.conf") #os.rename(pathname + "/conf/httpd.conf.bak", pathname + "/conf/httpd.conf") else: os.rename(pathname + "/conf/httpd.conf", pathname + "/conf/httpd.conf.bak") f = open(pathname + "/conf/httpd.conf.bak", "r").readlines() f2 = open(pathname + "/conf/httpd_new.conf", "w") #改变appache路径 for line in f: if 'c:/Apache24' in line: #line = "#"+line+"\n"+"ServerRoot "+os.path.abspath(".").replace("\\","/")+"/"+pathname line = line.replace("c:/Apache24", os.path.abspath(".").replace("\\","/")+"/"+pathname) #多个站点设置上级目录(这里直接写成根目录) line = line.replace("Apache24/htdocs", "") elif '<IfModule unixd_module>' in line: s_temp = """# php5 support LoadModule php5_module "%s/php/php5apache2_4.dll" AddHandler application/x-httpd-php .php AddType application/x-httpd-php .html .htm # configure thepath to php.ini PHPIniDir "%s/php" """ %
首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇番外一:关于thinkphp框架下的文.. 下一篇登录(ajax提交数据和后台校验)

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目