将 PHP-MySQL Web 应用程序转换为桌面应用程序 (exe)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3203100/
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 08:59:28  来源:igfitidea点击:

Convert PHP-MySQL web application to desktop app (exe)

phpdesktop-application

提问by shasi kanth

I have developed a PHP-MySQL web application, which is a school-based project. My client wants this application to be converted into a .exe file such that it can be installed on his desktop and use it.

我开发了一个 PHP-MySQL Web 应用程序,这是一个基于学校的项目。我的客户希望将此应用程序转换为 .exe 文件,以便可以将其安装在他的桌面上并使用它。

How the PHP website can be converted to a .exe file and can it be run without the need of a database/server software?

如何将 PHP 网站转换为 .exe 文件,并且无需数据库/服务器软件即可运行?

Please advice.

请指教。

采纳答案by Yousf

The convenient solution is not to convert the website to .exe. I think it will be better if you have portable server/php/mysqland make the website work from a usb or CD with autorun.

方便的解决方案是不要将网站转换为 .exe。我认为如果您有便携式服务器/php/mysql并通过自动运行使网站从 USB 或 CD 工作会更好。

回答by Avinesh Kumar

I was also looking for a similar solution and found https://code.google.com/p/phpdesktop/

我也在寻找类似的解决方案,发现https://code.google.com/p/phpdesktop/

Hope this helps.

希望这可以帮助。

回答by JL Griffin

try using a site-specific browser. it will make a desktop app that is basically a portal running to your webapp. try this one:

尝试使用特定于站点的浏览器。它将制作一个桌面应用程序,它基本上是一个运行到您的 web 应用程序的门户。试试这个:

https://mozillalabs.com/prism/

https://mozillalabs.com/prism/

It allows alot of advanced features like system tray icons and such. I have used it many times!

它允许许多高级功能,如系统托盘图标等。我已经用过很多次了!

Hope this helps, JL

希望这有帮助,JL

回答by Pekka

NuSphere's PhpDockclaims to do this: It serves as a deployment helper and comes with a bundled web server. However, I don't know about the database part, and it's not free.

NuSphere 的PhpDock声称可以做到这一点:它充当部署助手并带有捆绑的 Web 服务器。但是,我不知道数据库部分,而且它不是免费的。

PhpDock enables you to deploy any PHP web application as a Stand Alone Windows Desktop application w/o any changes in the code.

PhpDock 使您能够将任何 PHP Web 应用程序部署为独立的 Windows 桌面应用程序,而无需对代码进行任何更改。

I don't know that particular product, but I have been using their IDE for years and am quite happy.

我不知道那个特定的产品,但我多年来一直在使用他们的 IDE,我很高兴。

回答by Morfildur

Short answer: Not possible.

简短回答:不可能。

Long answer: It depends.

长答案:这取决于。

You could install a web- and database server on his machine (or create an installer that does it) and run the application locally on his machine.

您可以在他的机器上安装 Web 和数据库服务器(或创建一个安装程序来执行此操作)并在他的机器上本地运行应用程序。

or

或者

You keep the application on a server and just provide a launcher that opens his browser and points it to the URL of the application.

您将应用程序保存在服务器上,只需提供一个启动器即可打开他的浏览器并将其指向应用程序的 URL。

As Artefacto mentioned, it might be a good idea to switch to SQLite instead of MySQL but depending on how your application is written it might require a lot of code and SQL Query changes.

正如 Artefacto 所提到的,切换到 SQLite 而不是 MySQL 可能是个好主意,但根据您的应用程序的编写方式,它可能需要大量代码和 SQL 查询更改。

回答by Artefacto

No. You have at least to remove the dependency on MySQL (and use e.g. sqlite instead).

不。您至少必须删除对 MySQL 的依赖(并使用例如 sqlite 代替)。

Then, you would either have to:

然后,您要么必须:

  • Convert the webpages to windows dialogs. This would completely change your application (e.g. what would originally be http "form submissions" would be someting completely different). At this point, it'd much easier to write a .NET application
  • Bundle a web server (e.g. Apache) with PHP installed.
  • 将网页转换为 Windows 对话框。这将彻底改变您的应用程序(例如,最初是 http“表单提交”的内容将完全不同)。此时,编写 .NET 应用程序要容易得多
  • 捆绑安装了 PHP 的 Web 服务器(例如 Apache)。

回答by Emmanuel Mahuni

Php desktop is the way to go, it's actually very simple to modify to the version of PHP you want to use and is open source too https://code.google.com/p/phpdesktop/

PHP桌面是要走的路,实际上很简单修改到你想使用的PHP版本,也是开源的https://code.google.com/p/phpdesktop/

回答by Purefan

Another try would be to turn your php project into PHP-GTK (http://gtk.php.net/). Yet another one is to give HPHP a try (https://github.com/facebook/hiphop-php/wiki/) and try to turn the generated C code into something like a .DLL in .NET and use it for the logic while coding the UI in say, C#.

另一种尝试是将您的 php 项目转换为 PHP-GTK ( http://gtk.php.net/)。另一种方法是尝试 HPHP(https://github.com/facebook/hiphop-php/wiki/)并尝试将生成的 C 代码转换为 .NET 中的 .DLL 之类的东西,并将其用于逻辑在用 C# 编写 UI 时。

回答by Richard Knop

Just create a simple program in C or C++ that will just add icon in Start menu, desktop and Quickstart. If your client clicks the icon it will open the default OS browser and point it to URI of your application online.

只需在 C 或 C++ 中创建一个简单的程序,只需在开始菜单、桌面和快速入门中添加图标即可。如果您的客户端单击该图标,它将打开默认操作系统浏览器并将其指向您的在线应用程序的 URI。

That might fool your client :)

这可能会欺骗您的客户 :)

Or maybe it will be enough for him (he might be asking you to convert it to exe because he can't remember URI or something - ask him what is the reason).

或者也许这对他来说就足够了(他可能会要求您将其转换为 exe,因为他不记得 URI 或其他内容 - 问他原因是什么)。

回答by Sarfraz

Not sure that's gonna be possible but have a look at:

不确定这是否可行,但请查看:

WinBinder

活页夹

WinBinder is a new open source extension for PHP, the script programming language. It allows PHP programmers to easily build native Windows applications.

WinBinder 是 PHP(脚本编程语言)的一个新的开源扩展。它允许 PHP 程序员轻松构建本机 Windows 应用程序。

alt text
(source: winbinder.org)

替代文字
(来源:winbinder.org