Portable Web Application

We have a need to have a web based application running on a Windows machine, Win XP & up  that has NO internet connectivity or browser.

So our concept is, we put a "web server" on a thumb (USB) drive along with a browser and set up a bat file (or something) such that the user inserts the USB Drive into a USB slot &  clicks something on E: or ??. Assumming E is the thumb drive

The ideal case would be for the USB drive to "auto execute" to start the browser on the USB drive (maybe Chrome Portable or ?) with a specific address like "E:/localhost/folder" where folder contains the starting point (index.php or other) of the app

I tried using PortableApps.com; I got XAMPP to load onto a thumb drive & I have portable chrome there too but I can't figure out how to make it work.

I've heard about QupZilla, went to it, zero documentation so I have no clue how it works. PortableApps.com, no documentation. Is there no documentation for ANYTHING anymore?

Can someone suggest how to do this?

Thanks
Richard KortsBusiness Owner / Chief DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
NO internet connectivity or browser.
Without a browser, it is not a web application.  But your are trying to include Chrome which seems a contradiction.  And 'auto-execute' is blocked for security reasons on almost all machines.

If you would describe what this 'app' is supposed to do, maybe we can figure out a way.  A lot of documentation is supplied in HTML format without requiring a web server.  You put it in a single directory and cross-link the pages and load them as 'file://' objects.
gplanaCommented:
If no server logic on the app (i.e. if you don't need php nor database) then I would make an html file which links all the rest (images, some other html pages by using links, etc...).

If you need a database and also php you have 2 choices:

Option 1: Have xampp on your pen-drive, and ask user to install it (it's very easy to install, as it's just the typical wizard with "next->next" options).

Option 2: Have a web server (probably with also MySQL database) and have the application in there. Your computer don't have internet but probably have access to the network of your company (or home) where you can have this server connected.

You can get xampp at:  http://www.apachefriends.org/en/xampp.html

Hope it helps. Regards.
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:
The no internet connectivity is the worst case.

The app is a testing app for persons learning English as a 2nd language; specifically in Mexico, where there are cases with NO Internet connectivity, cases with Dial Up & cases with high speed.

We are trying to go with the lowest common denominator.

The app requires a MySQL database & a ton of php programs. Running it on the web from a real web server is a cinch.

I have XAMPP. I loaded it onto the Thumb drive using PortableApps.com. Everything goes on there. I am trying to test it on my own environment; both computers have browsers but I'm trying to run it off of the "E" drive.

Forget the auto startup. I just want to find Chrome on E, double click it to start (that parts works) & put in something like "E:/localhost/<path>". I do that & it doesn't find it.

I think maybe I have to initiate Apache & XAMPP (on the thumb drive) first.

But I'm still confused

Thanks
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

gplanaCommented:
instead of E:/localhost, just put:

file://E:\<path>

on the browser.
Dave BaldwinFixer of ProblemsCommented:
'localhost' is a specific place on the network.  Note that you need to test this on a machine that is not connected to the internet before you can be sure that it works.  And yes, you have to start XAMPP first before anything else is done.  Making that works in a 'portable' version is the first thing.
gplanaCommented:
take a look at the configuration of xampp. You should configure it to have its web folder to E:\path. Then it will work (with xampp started) when you put http://localhost on your browser.

Hope it helps. Regards.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:
To all,

I'm going to try your suggestions; I have to reinstall xampp (doing it right now, I had it in the wrong place). Then I will try those things.

Thanks!
gr8gonzoConsultantCommented:
So, a few things:

1. PHP is just the wrong choice for this type of thing, but if all of the code is already written, then there's not much you can do about it, I guess. I'm assuming the database choice is also off the table and you're stuck with MySQL. If this need comes up in the future and you're in the design phase, consider using C# or VB.NET for the language, and something like SQLite for the database. No extra services to set up - just compile and run.

2. XAMPP is fine and all, but you're going to need to adjust the configurations to be drive-letter-less. You don't know if the thumb drive will be E: in one machine, F: in another, D: in a different one, etc... Here's a guide that someone made with the various configuration options for a portal web server and DB server:

https://ruthsarian.wordpress.com/2014/09/12/a-portable-web-server-on-a-usb-stick/

...although the choice they made was to use PostgreSQL, you can probably use their example to determine the configuration changes to make to my.ini to make MySQL portable.

3. While http://localhost is the correct path, it makes the assumption that Apache will be running on port 80. Again, if you're going into an unknown environment, you won't be able to make that assumption for certain. It may be a safer bet to use a less-common port like 81 and your URL would simple change to: http://localhost:81/

There are enough apps out there that can commandeer port 80 (Skype is a good example. and happens to also be a pretty popular app in Latin American countries), so not changing the default port could set you up for some awkward on-the-spot troubleshooting when kids are supposed to be using the time to learn.

4. Once everything is configured, you can set up a batch file to launch the Apache service, the MySQL service, and launch Chrome with the initial URL pointing to your app. That way, it's one thing they click on to get started.

5. This is probably an obvious thing, but if it's a classroom environment, make sure you plan for one thumb drive per computer (unless you're copying everything to the hard drive, which MIGHT not be a bad idea, given the poor read/write speeds of thumb drives would probably result in a not-so-great browsing experience, but it all depends on how much I/O the PHP apps use).

It would probably be a good idea to have everything zipped up in a .7z file (7-Zip Portable), and then have a batch file that unzips the whole structure onto a folder on the hard drive. Be mindful of permissions issues - workstations running Vista or higher in a classroom environment might not let you create folders directly on C:, so you may have to plan on a good, writable folder for unpacking.  This way, though, you'll ensure that your source installation won't get overwritten if someone decides to run the app on the stick and start browsing and making database changes.
RobOwner (Aidellio)Commented:
Another approach is to utilise the offline mode and local caching of the browser: https://html.spec.whatwg.org/multipage/browsers.html#offline and http://diveintohtml5.info/offline.html describe this in detail.

I have done this with static html, css and js files but have not attempted it with php.  It did take a while but it did mean that once I got my manifest file working properly then the site worked completely offline. When internet connectivity returned it checked if it was running the latest version.

Off the top of my head you could fool the browser into thinking it is loading an html file with the use of a web router (so that html files are processed by a script, exactly like they are on EE!)
gr8gonzoConsultantCommented:
@Rob - PHP files require a server to process them - you can't serve them pre-cached like static files without the need for some additional compiler application. By themselves, they are just source code, and the browser has no idea how to interpret that. At the point of getting into a compiler, it becomes simpler just to use a portable web server.
RobOwner (Aidellio)Commented:
@gr8gonzo, I'm aware of that. That's what my point regarding a web router would solve. E.g. Slimframework.com
gr8gonzoConsultantCommented:
@Rob - I don't quite follow. I haven't used Slimframework.com before, but at first glance, it appears to be a framework built on top of PHP, so it'd still require some PHP engine to process it...?
RobOwner (Aidellio)Commented:
I haven't tested it but willing to explore the flaws in my theory :)

Slim is built on PHP, that's right, however the processing only needs to happen when the device is online.  When offline, the cache manifest will contain the html files as if they'd been generated by PHP.  Slim just takes a request like yourserver.com/one/two/three.html, parses it and performs the necessary action (using a php script) and returns the relevant markup.  So as long as each request can be stored as a html file in the manifest then it should work.

The other issue here is what is the actual application?  If there is a login (or other database / file system interaction) involved then a thumb drive with a server with a cached copy of the database is a security risk let alone a lot of work to get it to synchronize with any centralised server.
gr8gonzoConsultantCommented:
Is there a reason you picked that particular answer? As I mentioned in my comment, setting it to a specific drive letter may cause problems for you later on...
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:
It's the closest thing to what seemed OK. I am off on another project & this one is lower priority right now.

EE bugs me about "abandoned questions" adter a short time, I'm trying to get that cleared up.

We can handle the drive letter in the documentation.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.