Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to write a program in PHP, Ruby, or Python, and make it easily downloadable and installable by general users like a Win32 app?

I wonder when we write a program in PHP, Ruby, or Python, how do we make it easily downloadable and installable by general users like a Win32 app?

and is it possible to make it a Mac app easily too?

like image 717
nonopolarity Avatar asked May 13 '09 13:05

nonopolarity


3 Answers

Ruby

RubyScript2Exe

RubyScript2Exe transforms your Ruby application into a standalone, compressed Windows, Linux or Mac OS X (Darwin) executable.

There's also a decent blog post about it

Another possible option is the Shoes GUI framework, which can create Widows, Linux and OS X executables from your Shoes application.

Python

py2exe

py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

py2exe is used by BitTorrent, SpamBayes, and thousands more

PHP

Bambalam PHP EXE Compiler/Embedder

Bambalam PHP EXE Compiler/Embedder is a free command line tool to convert PHP applications to standalone Windows .exe applications. The exe files produced are totally standalone, no need for php dlls etc.

and is it possible to make it a Mac app easily too?

Py2App

py2app is a Python setuptools command which will allow you to make standalone application bundles and plugins from Python scripts. py2app is similar in purpose and design to py2exe for Windows.

Also, there is a utility "Build Applet" included with the Developer Tools.. Drag-and-drop a Python script on to it and it becomes a .app. The utility is in /Developer/Applications/Utilities/MacPython 2.5/


Note, all of the above basically take your script, package it up along with a Python interpreter and any dependancies, and on launch run your script. If you use a GUI platform that does not work on Windows, running it through Py2EXE will not make it work!

Also as Peter D mentioned, you need to be careful about dependancies - if your application requires a MySQL database, your users will have to install that separately to use your application, and every library you use will add size to your executables.

like image 172
dbr Avatar answered Nov 04 '22 11:11

dbr


At least with PHP and Python, I know there are GTK bindings (http://gtk.php.net/ , http://www.pygtk.org/) for Windows (http://www.gtk.org/download-windows.html). Packaging the application in an easily distributable package becomes a little tricky, but it can certainly be done. If you're talking about PHP in the Web App sense, typically, the user will have their environment setup, and all they need to do is unpackage the scripts.

There are other widget bindings for these languages, I'm just listing GTK as a fairly common binding.

Once you have the application setup correctly, it's a relatively simple matter of generating an installer for your application. There are various solutions for this, one of which is NSIS (http://nsis.sourceforge.net/Main_Page) which makes creating installers quite easy. It's scriptable, so there is lots of customization.

like image 1
drowe Avatar answered Nov 04 '22 10:11

drowe


I think your question should be, "How do I write PHP/Ruby/Python apps to be able to be easily downloaded and installed on Windows machines?".

If I write a PHP application to take advantage of a MySQL database I now have to take into consideration (when packaging the app) if the user will install and setup the database themselves or not. Maybe I will use the SQLite database instead to save the user from having to run a database themselves.

So I think the important thing here is not to understand how to package your app so users can download it easily. It's how to create the app to make it as portable as possible.

like image 1
Peter D Avatar answered Nov 04 '22 11:11

Peter D