views:

937

answers:

5

Hi,

I have an existing CakePHP that runs on a LAMP environment and need to install it on a USB drive for mass public distribution.

There are a few requirements:

  • Protect the source code
  • No installation required
  • Windows support essential
  • MAC & Linux would be a bonus
  • Must run offline, without Internet connection
  • Ability to sync with server for data transfer and updates

I have conducted a large amount of research into the options and am keen to learn what other developers think.

Potential solutions: - Flash / XML - Adobe AIR app - USB webserver (Server2Go, Portable Apps XAMPP)

Has anyone used any of the above, any comments would be greatly appreciated.

Thanks

+2  A: 

You can use MAMP for Mac, you'll just need to edit the config to properly point the sites directory.

however you would have the problem that the mysql db would not necessarily work with windows. if you switched the db to sqlite, you could sync the sqlite db file fairly easily.

XAMPP would work for the windows side

sorry dont know about the linux side.

Mike Valstar
+1 for MAMP on OSX - I use it and it works great (and is completely self-contained)
inkedmn
XAMPP - X represents cross browser. you can get OS X and Linux versions with XAMPP.
thephpdeveloper
+3  A: 

You will have problems with this, no matter how you go about it. Each step is a little more unusual it seems.

You'll need to use a source code obfuscator to protect your source. I recommend the one by Zend, not from experience, but because Zend makes awesome products. Never used a source protector myself.

You'll need three custom LAMP/MAMP/XAMP installs, one for each target OS. They should point to a directory that is shared on the USB drive. Make sure you configure them to use an unprotected port, otherwise the user will need admin privileges to run the server software. And getting the server stuff up and running will likely result in a few hiccups as well.

I would actually recommend finding something that will allow you to distribute a binary, or something like an AIR app that is intended for this type of distribution. You may have to rewrite lots of code, but it'll be easier to fix than all the niggling little install errors you'll see on the client end. To package scripts into binaries without rewriting stuff, check out http://www.scriptol.com/apollo.php and similar products.

But I'd suggest you make a standalone app in adobe air that will sync with your server (maybe even some google gears integration, to have it function offline). Don't try to force a PHP app into this distribution model, it'll create nightmarish problems.

Travis Leleu
+2  A: 

Out there is a CakePHP InstaWeb Server

http://bakery.cakephp.org/articles/view/the-cakephp-instaweb-webserver

that runs on python and doesn't need an installation. This plus some additional goodies should get you already half the way.

Christian
+3  A: 

Similar thread here : http://stackoverflow.com/questions/508909/portable-usb-webserver

If you ask me, XAMPP should do, because it offers a "plain unzip" version. There's lots of variety out there - Bitnami also offers a nice bunch of stacks, although they may not be good for this particular task.

To keep the same scripts in both Windows and Linux, you could consider using UnxUtils which is a port of all common Linux commands. This will be very handy if you are good at Linux bash shell scripting but not good at Windows batch files.

Protecting the source code is a bit troublesome. Do you really, really need to do so? Because there's a ton of great open source code out there which already does practically everything in most common business domains - sourceforge.net.

And if someone's taking your code and calling it their own, you can just name them on the internet if you can prove it. That itself will be bad publicity for them. That said, I obviously don't know your specific need. So that is just my opinion.

namespaceform
+1 for mentioning plan unzip for XAMPP. XAMPP can work on any folder as long as not installed as service
thephpdeveloper
+1  A: 

This is what I used to run a CakePHP app from a DVD. Worked on USB too (while I was still developing it).

http://www.server2go-web.de/

Server2Go is a Webserver that runs out of the box without any installation and on write protected media. This means that web applications based on Server2Go can be used directly from cdrom, a usb stick or from any folder on a hard disk without the hassle of configuring Apache, PHP or MySQL. Server2Go allows you to create a standalone working web site or PHP application on a CD-ROM.

It's really nice.

Eduardo Romero