23

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.

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

Please advice.

4
  • 5
    Your client's wishes has no sense. Tell them that it is client-server application, not desktop one. Jul 8, 2010 at 12:42
  • 5
    is a shortcut icon good enough? Jul 8, 2010 at 13:07
  • I think this is what you need.
    – user1745487
    Oct 14, 2012 at 20:09
  • Hi Czarek, I was looking through your program before I found this page. Great stuff! But from what I see your program the .exe has to be in the folder to work. Is there anyway to compile the package when done into one .exe so there is just one file needed for desktop?
    – Jon
    Aug 15, 2013 at 15:48

11 Answers 11

13

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

1
7

NuSphere's PhpDock claims 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.

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

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

6

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

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

3
  • Thanks for that hint, I think this is the best solution and it is helping me already. Mar 13, 2012 at 14:32
  • glad i could help :) additionally, i have sometimes found that prism is kinda hard to deploy on a larger scale since it isnt installable per say to package your specific ssbs into. If you really want deployable, what I did in one of my recent projects, was create a blank adobe air template in aptana2 (dont use 3 because it doesnt support the addon of the air SDK) and simply used: <html><head> <meta http-equiv="REFRESH" content="0;url=http://where-you-want-to-redirect-to"> </head></html> to link to the actual website, if you use the newest SDK, it runs a webkit rendering engine & runs html5
    – JL Griffin
    Jan 28, 2013 at 6:22
  • i actually may write a tutorial about this and publish somewhere. lol. this particular business wanted it this way because running in a browser with an address bar, etc opens vulnerabilities fom other tabs that employees may open, an ssb doesnt have such vulnerabilities. anyways, Ill link to it if i do make one. Cheers!
    – JL Griffin
    Jan 28, 2013 at 6:27
5

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.

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.

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.

0
3

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

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.
1
  • The second option suits me well, using wapache. It also supports sqlite. Feb 5, 2011 at 3:58
2

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#.

1
  • 1
    sorry but developing my application in GTK from scratch is a pain. Dec 8, 2010 at 9:39
1

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.

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).

4
  • Hi, thanks for all your replies. Here the sole purpose of converting the php app into a stand alone app is to sell the product to the clients as a software. So once they pay the amount, they will be handled the .exe file on a CD, which they can use to run the application. Also the software must allow one time installation on a system, so that the same CD is not reused again in the same system (like the genuine OS installation). Coming to the point, SQLite can be used as the database for this instead of mysql. I can rewrite the application, not a problem. Iam also considering the GTK option. Jul 9, 2010 at 11:47
  • but I dont know how to develop using it. No proper documentation is available. By the way, i came across this software that converts a php app into a .exe file. It is not free though: byterun.com/website-compiler.php Jul 9, 2010 at 11:48
  • Hi, i have across this product, that claims to convert the php app into a standalone app. roadsend.com Jul 11, 2010 at 7:35
  • Recently i came across another good opensource tool, called wapache, that comes with inbuilt server. Refer: wapache.sourceforge.net Feb 5, 2011 at 3:57
1

You can use xampp open-source project to pack your PHP site into an executable file.

Use the following steps:- 1. Download Xampp source code.

  1. Add your PHP file inside htdocs directory(Ref:- https://sourceforge.net/p/xampp/code/HEAD/tree/win32/xampp/htdocs/).

  2. Now compile the XAMPP source code and distribute it.

  3. For DATABASE creation and initial data loading in the database, you can code your site in such way that if database is not created, it redirects the page to install.php which do the database creation and data loading task using sql file provided(you need to add SQL file containing database structure and required data).

Don't forget to delete the SQL file post installation of database.

1

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.

alt text
(source: winbinder.org)

4
  • If i understand the question correctly it's not what he asked for (as that would be a full rewrite of the application).
    – user253984
    Jul 8, 2010 at 11:45
  • @dbemerlin: Yes, conversion seems to be not possible unless someone comes up with a real solution, I have just posted the other steps he might want to take.
    – Sarfraz
    Jul 8, 2010 at 11:48
  • 1
    Complete re-write is not an easy option! Even if he decide, dealing with PHP's echo is much different than GUI manipulation. Anyway WinBinder is nice concept.
    – Yousf
    Jul 8, 2010 at 11:56
  • 1
    @Yousf: Agreed and as I said, if there is a solution to convert existing web application into desktop application, it will be the way to go.
    – Sarfraz
    Jul 8, 2010 at 12:07
1

Solution 1: There are several solutions to convert your web application into a desktop application, the one I prefer is the open source solution: PhpDesktop, but unfortunately it only supports SQLite.

Best Solution: To convert your PHP application with MySQL I know a paid solution that does this: 'ExeOutPut For Desktop', it is the best for this job

1

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://github.com/cztomczak/phpdesktop

2
  • This link is not working. Apr 14, 2022 at 13:56
  • simple google of the same thing shows author moved to Github Sep 15, 2022 at 17:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.