views:

651

answers:

7

What is the best way to build a non web browser stand alone php app that works with some sort of database without requiring the user to install a database server. Or am i just asking too much?

+5  A: 

Embed the SQLite database in your app, then configure PHP to talk to the SQLite database:

http://us.php.net/sqlite

runako
It still wouldn't be a "standalone" as you'd need to install a PHP interpreter. And without a browser, it'll basically be a command-line script.
Calvin
Good point. Then again, the command-line script requires a command-line interpreter, which requires other components. Pretty much won't be standalone unless he writes in ML against the machine, eh? Then again, he did ask for a PHP solution, so I think we can assume a working PHP interpreter. This solution will prevent the need for a database server and a web server, which was the question. (He wants a command-line script as his result, re-read the question.)
runako
He only asked that the user not have to install a DBMS not that the use not have to install PHP.
jmucchiello
A: 

Take a look at this 3 links

PHP GTKenter code here http://gtk.php.net/

FLEX http://www.adobe.com/products/flex/?promoid=BPDEQ

AIR http://www.adobe.com/products/air/

I think any those will help you, check it out.

Oakcool
+6  A: 

If you're targeting Windows, try WinBinder. It allows you to develop native Windows applications using PHP.

It also supports SQLite, so you don't need a database server.

Steven Richards
Looks like this may not be an ideal choice — they clearly label it as being "under development", but no new releases have been made since 2006.
Ben Blank
True. The forums are still active and WinBinder's developer still posts; basically, the project needs either funding or additional developers to continue. Part of the problem is that most PHP developers don't know C, which makes it difficult for people interested in this type of thing to help with development. In any case, WinBinder appears to be mostly stable and supports PHP 5.1.x.
Steven Richards
A: 

I don't have any experience with it but there's a portable version of XAMPP.

You wouldn't necessarily have to use the Apache portion. The app could just run from the command-line, depending on what you're trying to do.

Mark Biek
+1  A: 

I'd suggest you try miniPHP. It is basically an IDE around Winbinder; it lets you concentrate on writing PHP while it takes care of details like compiling the application. You can create either GUI or command-line apps and it works just fine with both SQLite and MySQL. It has a preview mode and some debugging capabilities too.

djn
+2  A: 

Have a look at php compilers, you'll end up with a binary for people to run. It could be a desktop GUI application, or a "web server in a box" type of thing.

xkcd150
A: 

Here is an idea: information can be stored in XML and thus usage of database can be avoided. That will work only for certain kind of purposes of course.

Petrunov
Without more data about what the submitter wants to do, this is probbaly the best idea. Who knows, even a text file could work. If the data is not large, or even fairly large, but not needing relations, flat files cab be great.