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.

Yoon5oo
  • 496
  • 5
  • 11
shasi kanth
  • 6,987
  • 24
  • 106
  • 158
  • 5
    Your client's wishes has no sense. Tell them that it is client-server application, not desktop one. – Your Common Sense Jul 08 '10 at 12:42
  • 5
    is a shortcut icon good enough? – corymathews Jul 08 '10 at 13:07
  • I think [this](http://www.bambalam.se/bamcompile/) is what you need. –  Oct 14 '12 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 '13 at 15:48

11 Answers11

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.

Yousf
  • 3,957
  • 3
  • 27
  • 37
  • Since Windows 8, autorun doesn't work on usb for security reasons. You can try https://www.exeoutput.com/ or make a CDFS partition http://www.visualdesigning.com/articles/how-to-create-autorun-usb-drive/. Here you have some other PHP to EXE compilers http://www.thefreecountry.com/compilers/php.shtml – garatu Apr 21 '16 at 23:58
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.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
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

JL Griffin
  • 423
  • 4
  • 16
  • Thanks for that hint, I think this is the best solution and it is helping me already. – Marcos Buarque Mar 13 '12 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: ` ` to link to the actual website, if you use the newest SDK, it runs a webkit rendering engine & runs html5 – JL Griffin Jan 28 '13 at 06: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 '13 at 06: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.

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.
Artefacto
  • 96,375
  • 17
  • 202
  • 225
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#.

RamC
  • 1,287
  • 1
  • 11
  • 15
Purefan
  • 1,498
  • 24
  • 44
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.

Ravinder Payal
  • 2,884
  • 31
  • 40
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)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Sarfraz
  • 377,238
  • 77
  • 533
  • 578
  • If i understand the question correctly it's not what he asked for (as that would be a full rewrite of the application). –  Jul 08 '10 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 08 '10 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 08 '10 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 08 '10 at 12:07
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).

Richard Knop
  • 81,041
  • 149
  • 392
  • 552
  • 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. – shasi kanth Jul 09 '10 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: http://www.byterun.com/website-compiler.php – shasi kanth Jul 09 '10 at 11:48
  • Hi, i have across this product, that claims to convert the php app into a standalone app. http://www.roadsend.com – shasi kanth Jul 11 '10 at 07:35
  • Recently i came across another good opensource tool, called wapache, that comes with inbuilt server. Refer: http://wapache.sourceforge.net/ – shasi kanth Feb 05 '11 at 03:57
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

Finwe
  • 6,372
  • 2
  • 29
  • 44
Emmanuel Mahuni
  • 1,766
  • 16
  • 16
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

Tarik Benali
  • 47
  • 1
  • 7