views:

32

answers:

2

Hello all I need Apache server with php interpreter to distribute in my desktop application The reason is that my application create reports that are basically php code that runes under Apache web server
Is it user friendly to distribute Apache server with php interpreter with your desktop application ?
Also I like to be able to start / stop the server from my application I know its not common but how can it be done.
So that none techi user will not get into trouble

+2  A: 

I once did a project like this, but chose to use lighty instead of apache due to how big an Apache distro is.

If you want to use Apache, take a look at XAMPP. It includes more than just Apache, but it's very easy to get up and running.

Since my target distribution was Windows, I used AutoIT to write a script that would:

  1. start the server
  2. launch a browser
  3. shut down the server when the browser was closed

I compiled the AutoIT script to an exe, and that's how my users would run the program. You didn't specify your target platform. If it's mac or *nix, you could write a shell script to do the same thing. The key is that it would need to run in the background waiting for the browser to be closed.

I used NSIS to create an installer, to setup everything and create icons in the start menu.

Since I was trying to keep filesize down and not rely on an internet connection, I used sqlite for my database instead of MySQL.

I also chose to distribute the K-Meleon browser with my application so that I would always know what browser my users were using to interact with my code.

A couple things you'll want to keep in mind:

  • Lighty should be configured to
    • use a non-standard port in case your users already have something running on port 80
    • allow connections from localhost only
  • You may want to rename the executables for both lighty and k-meleon so that you know they're the processes being used by your application.

While I've done this type of project before, I probably won't build something this way again in the future and I don't recommend it as a method for building desktop applications.

I decided to build my application this way due to the fact that I would soon be leaving my job and since I had built our website in PHP, I figured that whoever took my place would know PHP and building the application this way would ensure that they could provide support for it.

bradym
how do you detect when the browser has closed ?
I've posted my autoit script at http://pastebin.com/qqJ3FK4k
bradym
A: 

Cool Great work !

AjayK