我如何为网站创建安装程序。php mysql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4388513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 12:54:47  来源:igfitidea点击:

How I can create installer for website. PHP mysql

phpmysqlinstaller

提问by SameasBefore

I have a website which made.

我有一个网站。

I need to know how i can create a installer for this site. Meaning when user upload the site on to they host first time they get option to inset they database details.

我需要知道如何为此站点创建安装程序。这意味着当用户第一次将网站上传到他们的主机时,他们可以选择插入数据库详细信息。

User insert they database details which then they change in config.php file.

用户插入他们的数据库详细信息,然后他们在 config.php 文件中更改。

also i have tables.sql which i like to run query

我也有我喜欢运行查询的 tables.sql

I try using

我尝试使用

$text = file_get_contents();

but my querys fails as i do have around 32 tables i need to inset into database and all the necessary setting.

但是我的查询失败了,因为我有大约 32 个表,我需要插入数据库和所有必要的设置。

回答by Gordon

There is a number of tools that aim to achieve this, with different feature sets:

有许多工具旨在实现这一目标,具有不同的功能集:

These are collected from a blogpost by cweiske

这些是从cweiske的博客文章中收集的

If you dont need a generic tool, the easiest would be to write a simple install script and ask users to run it. This can be as easy as a single file that prints a form and asks for the required details. When submitted, do the necessary install routines.

如果您不需要通用工具,最简单的方法是编写一个简单的安装脚本并要求用户运行它。这可以像打印表单并询问所需详细信息的单个文件一样简单。提交后,执行必要的安装程序。

回答by Ignacio Vazquez-Abrams

There is no universal standard for deploying PHP apps. Provide a tarball containing the PHP files in a directory, as well as the SQL schema, sample configuration file, and deployment documentation.

没有用于部署 PHP 应用程序的通用标准。提供包含目录中 PHP 文件的 tarball,以及 SQL 模式、示例配置文件和部署文档。

回答by Fernando André

You can try to set check_foreign_keys = 0 ; then import the tables from the file and you need to have config.php world writable if you whant the web app to write the initial config to it.

您可以尝试设置 check_foreign_keys = 0 ;然后从文件中导入表,如果您希望 Web 应用程序将初始配置写入其中,则需要使 config.php 世界可写。

Best regards, FR

最好的问候,法国