I have to develop an application for a gas agency where a database will store consumer numbers, names, addresses, and date delivered for a town with nearly 20,000 people. I only know PHP, MySQL, CSS, jQuery, and other web based technologies. Is it possible to deliver a package to the client using these technologies that can be installed on a computer and used locally?

This application will run on a single PC for a single user. I'm familiar with tools such as XAMPP, but I do not want to run a web server locally. Both the application and database will be securely running on a particular computer. In the future, if this application must be on multiple computers, I want the database and application to be portable.

I have searched for similar questions on Stack Overflow and I did find some recommendations like Jetty, Adobe Air and the recent Web SQL database. Is PHP GTK also a viable tool for building professional applications?

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

(you will have to close that webserver when your application is being closed)

SQLite is a simple database and don't need to run any additional service, a php builtin server that is explained in step 2 is all that is required to connect to sqlite database. In php.ini you need to load PDO extension + pdo_sqlite.

You create a c++ wrapper only once and it's easy, then you can run your php scripts as a native windows application - a IE webbrowser control is created inside your application's window and it navigates to 127.0.0.1:1234, which is the output of your php scripts. It looks like a regular program, but it's really an embedded browser inside your application.

There is no installation of apache, php or mysql required - it's like running native windows application. A small c++ wrapper that can be easily created with simple wizards and that can run your PHP scripts later on clients machines, with no hassle, with a feeling of a normal desktop application:)

There is no need to install anything, as it uses PHP 5.4 which comes with a builtin web-server, it can be started easily with 1 line using c++ call to ShellExecute(). For database you can use SQLite which does not require running any service, php alone is sufficient.

where from c++ jumped in ? I hope where u used c++ app it can be replaced with ` PHP app ` !
–
MegaRacerFeb 6 '12 at 20:16

@kushal: read it again more carefully, you create a c++ wrapper only once and it's easy, then you can run your php scripts as a native windows application - a IE webbrowser control is created inside your application's window and it navigates to 127.0.0.1:1234, which is the output of your php scripts. There is no installation of apache, php or mysql required - it's like running native windows application. A small c++ wrapper that can be easily created with simple wizards and that can run your PHP scripts later, with no hassle:)
–
Czarek TomczakFeb 7 '12 at 4:54

@kushal I've edited my answer and added a short summary, hope it clears the things now. And yes, you can call it a "PHP app"! A guy with c++ experience could help you create this wrapper for running your php scripts on clients machines within 30 minutes (but I think you can create it even by yourself, it's easy) - and you can use this skeletion later for many of your PHP apps.
–
Czarek TomczakFeb 7 '12 at 5:07

okay ,i will try . But will the interactivity ,speed and performance of a general app developed with this style of coding you mentioned be comaparable with typical standalone apps (the one with java or any such desktop programming language) ?
–
MegaRacerFeb 12 '12 at 7:29

1

@kushal, good to hear from you as for the last few days I've been working to make this idea "live", I already have working code and am adding many new features, there are still some issues as I want it to work "professionally" so I put the requirements high to myself. I've created a project at google code and have already created some documentation, have a look: code.google.com/p/phpdesktop . Regarding your question about interactivity and speed: Yes. For interactivity use XMLHttpRequest + JQuery, PHP itself is fast, you just need to know what you're doing.
–
Czarek TomczakFeb 12 '12 at 14:54

Why screw around trying to hack something together with technologies that werent designed for desktop app development, when you can use an actual desktop development tool to create an application with far less hassle?

Whatever you think you'd be saving by not learning a new language, you'd be wasting by trying to fit a square peg into a round hole. Use the right tool for the job.

Download something like Visual Studio Express for either C# or VB.Net, and try that out. Or Delphi, if you have a little budget to work with. You say you know PHP & MySQL. Well, SQL is SQL, so thats not an issue regardless of the language you choose. C# syntax shouldnt be too different from what you are used to looking at in PHP. But VB.Net shouldnt be too hard to approach, either. Delphi makes nice self-contained executables, making distribution much easier. Those are just a few options. There's also C++. Python, Java....

I am sorry but this isn't an answer. Many good technologies can be used for new purpose.
–
SimonFeb 7 '12 at 12:20

1

Can and should are two very different things. There has to be some practical advantage to doing so, especially when you'd have to jump through hoops and introduce unnecessary complications (perhaps installing a web server process) to get it working.
–
GrandmasterBFeb 7 '12 at 19:11

A web application intended to be used by one person can be hosted locally, since a personal computer can act as a server, hosting:

A web server.

IIS is very easy to setup on any Windows machine and you don't need to download anything; Apache must be downloaded, but is very easy to setup too.

PHP.

Once you have Apache/IIS, downloading and installing PHP is not very hard.

An SQL database.

Most databases are ordinary products which can be installed on personal computers. The only problem would be the cost, but this doesn't concern you if you choose SQLite or a free version of Microsoft SQL Server or a free version of MySQL.

SQLite would be probably the easiest. One less product to install is always better when you deal with a personal computer, and not a strictly controlled, protected and documented server environment.

A web application can also be used locally. Instead of entering an URI of a remote server, like http://example.com/, you'll use http://localhost/. While some browsers will refuse to run JavaScript of an HTML file you open from disk (file://.../Desktop/Example.htm), this is not a problem with localhost URIs.

Now, how the web application will be used? You said:

I have to develop an app for a gas agency where a database will store consumer numbers, names, addresses, and date delivered for a town

So if I understand well, you'll have several employees of the agency using the same application, right? In this case, you can't just install your web application on personal computers. They must share the same database, which requires to host it on a machine which will be accessed from others, i.e. a server. From that point, you have several approaches:

Host an SQLite file on a shared drive (it may even be a NAS, not a real server) and access it from several PCs. This approach is fundamentally bad.

Since you're actually accessing the file itself, directly, if several users will perform an action at the same time, bad things will happen: the file will be locked by one user, or maybe some user will overwrite the changes made by another, etc. Don't do it.

Host an SQL database on a server, i.e. a simple PC of the agency that they will call a server, and everything else on PCs. Technically, you can do it. For example in server environments, it's not unusual to host the database and the application itself on different machines, mostly for performance reasons (some servers would be optimized for data manipulation, others - for computation).

While particularly relevant in server environment, this approach must be avoided when possible in a context like yours, for security reasons. By providing a direct access to your database from any machine of the agency, you reduce the safety of your data. You may configure the security properly to protect the data from a malicious user, but you'll spend a few months doing it, and with some SQL products, it's not even possible.

Host everything on a server (i.e, again, a simple PC of the agency). This is probably the most viable solution. You'll have to access the web application by typing something like http://192.168.1.13/, which is ugly, or the name of the machine, which is, in most companies, even uglier. But still:

The data of the agency is protected from malicious employees,

When fixing a bug, you have to push the update to one machine only, not to PCs. The same applies to PHP itself. Would you rather update to PHP 5.3.11, once it's released, on one server, or you prefer doing it on PCs?

Your source code is visible only by people who can access the server. You don't want any employee being able to read your PHP source code.

There is only one version of your code. If you host your app on every PC, what will happen if one is actually broken while you push the update? Or what happens if an employee decided to modify the source code of your application?

There is only one configuration to take in account, the server's one. PHP abstracts quite well the underlying hardware and configuration, but still. What if you need to store a temporary file, and you decide to write it to C:\Windows\Temp, and later you discover that on a precise PC, this part of your code crashes, because there is no C: on this PC?

You have put quite an effort to answer but sadly this is not what i am looking for . App needs to run on a single PC( its a small agency) so what i was expecting as a solution is to not to use xampp environment kind of stuff or i can say i do not want to use a db server (which is obvious as the app will be on one PC) . For this only. i mentioned "local storage" above . I did made a comment below regarding one PC thing but i am sorry for not updating it above .anyways i am updating the question above as it is creating a confusion. Still will be giving +1 to your effort:)
–
MegaRacerFeb 5 '12 at 19:29

3

I'm confused, reading your edit. You say "App will be running on a single PC": But then, you add: "Also if in future this app needs to be on more than one PC , i want my database and app to be portable too.": either you want it to be used from a single machine, or you want it to be portable with the ability to be used from several machines. In the first case, only the first part of my answer (before "Now, how the web application will be used?") applies. In the second case, the whole answer is still valid.
–
MainMaFeb 5 '12 at 20:23

the question is better edited now . The thing is ,i want a standalone app not involving web server and apparently not a web browser for for its access.
–
MegaRacerFeb 6 '12 at 15:53

@kushal: this is very different from your original question. I suggest that you post a separate question, asking if and how is it possible to run a web app without a web server or a browser, which is a quite strange request by the way. While PHP doesn't need a web server to run (php.net/manual/en/features.commandline.usage.php), choosing HTML and CSS for a non-web app is awkward. What about learning a language and paradigms already used for desktop applications?
–
MainMaFeb 6 '12 at 17:43

I understand you but the use of word DESKTOP in title says it all . The other hint could have been my edit of PHP-GTK . anyways this is what i intend my app to be -a desktop one . And about learning other language -man,this is exactly what i was scared of and the question came after out of this scareness only :(
–
MegaRacerFeb 6 '12 at 18:18

for an app to be installed on a single computer ,it doesn't seem appropriate to install mysql and go for any such db server . these are better suited for multi users where security and privileges is an issue . I am looking along the lines of desktop scenario where storage is local (without a db server).
–
MegaRacerFeb 5 '12 at 11:55

Alternatively you could try Server2Go. Basically it is a standalone WAMP server that you can put on a CD/USB disk etc. The problem with that would be the MySQL db would be read only if the server is to be on a CD. But then you can always use SQLLite db stored in the local disk or get around it differently.

I'm thinking Titanium will solve your problem... I should add that I haven't used it enough to know how good it is but there usually are positive reviews about it.

If your database is not online (I mean you database is not updated), you can use JavaScript, HTML and CSS to make your offline app (jQuery is a library of JavaScript).
If your database is updated, you can make a website to display it to your clients. And you can ask your clients to add bookmark to your website to update info, or you can make Chrome apps (if your clients use Chrome as web browser) for you clients install directly on their Chrome web browser.

You just need to install a single application and you have a NoSQL database with a web interface called Futon. You can easily create db-connected, lightweight web applications with html + javascript. CouchDB documents are available from web browser, and your program code (HTML + JavaScript + ...) can be like that too. And you don't need to install and configure PHP, MySQL, etc.

"CouchDB documents are available from web browser, and your program code (HTML + JavaScript + ...) can be like that too. " Sorry , i din't get you here ?
–
MegaRacerFeb 6 '12 at 18:42

I am sorry. My english is not very well. I mean CouchDB is available from webbrowser (default on port 5984) and You can store and serve your web page (HTML, javascript, etc.) from database. There is GUI tool embedded into CouchDB and it works like that.
–
marcinpzFeb 7 '12 at 7:10