"Minified" version of xampp?
I'm looking for a way to share my php applications with a colleague without using a server. My colleague isn't really versed in xampp and localhost stuff, so ideally, he shouldn't have to install or configure anything.
I'm already using SQLite to make my application more portable, but I need to figure out how to handle the php side of things. Is there a way to create a "mini" xampp or localhost that the php files can run on? Ideally, my colleague should just need to start up one program, at which point the localhost address would point to my files. Is something like that possible with xampp?
You can start a web server using the php executable:
php -S localhost:8000
You can use ngrok. ngrok build a url for your localhost project. which you can share to your colleague or anywhere across the globe.
You can use Devserver. It's portable. You just have to put the Devserver folder (with your files in
Local Directory) on a USB key.
It should be said that there are very, very few times where what you're talking about should be necessary. If this is a truly "personal use" case, you could just put the scripts online and set up an htaccess password for your friend. If it's software you're trying to distribute, you could create cloud access for it.
Having said that, I do have a piece of software in the wild that matches this description. The reason it needs to run its own server and be accessible locally is because it (a) runs in retail stores, (b) serves and receives data with a corporate android app only on the local network in those stores and (c) must continue to run with local data if the internet connection goes down at any given store.
The only way to do this at the moment is ship a physical mini PC stick, preloaded with XAMPP, the database, and the whole set of PHP scripts and a nice index.php file at the local root, to each and every store. In my case, this required building an internal update mechanism to push software updates as necessary. But you could probably just have your friend download a zip file with updates and replace his www root folder with it.
If you can afford $100 for a cheap PC on a stick, this is probably your best answer. It's definitely the fastest. You could wade into trying to compile your PHP code, but there is no complete solution for that.
It is actual question for me to, so I made a little research and from what I have read the most perspective way is to use a vagrant. You still will need to do a lot of configurations, but mainly on your side. Your college can deploy fairly easy and pain fry.
I found this article describing a basic workflow very useful.
Update #2: If for some reason vagrant or any other type of virtualization is not an option for you consider looking to portable xampp launcher instead
- Do you actually need a webserver? What kind of app is it? As far as we can guess, it may very well be a command-line script, as you did not specify your app's mode of operation. If it is a "true" web app, which has to be viewed in a browser, tim's answer may be the most simple and portable answer. (If you don't really need some fancy stuff, like Apache's URL rewriting and whatnot.)
- @Smuuf It is supposed to be a web app you view in your browser, yes. Also, it should only work for the computer that localhost is running on. It makes use of .htaccess a bit, too.