Other scripting languages popular on the web, such as Python and Ruby, are used in desktop applications. However, I've rarely (if ever) seen a PHP application designed to be deployed on a desktop. Why is this? What about PHP is holding it back from this, or what about these other languages make them popular for the dual use?
I'm not a PHP guy; but I imagine it is a lack of a desktop library and/or a lack of a designer (e.g. winforms).
Note that I have no idea if PHP actually does have these things; I'm just assuming so...
@Giovanni Galbo: I'm not sure if that's it. Apparently, you can use PHP to make graphical desktop apps. That I just learned from Wikipedia.
Every so often I wonder the same thing and start looking around for tools to do the job. Soon after I realize that the tools are not very mature. So then I start to wonder why no one has written any tools - or at least why the tools that do exist have not matured.
The only thing I can think is that PHP started life as procedural language whereas Python and Ruby tend toward being Object-Oriented or are fully object oriented (depending on who you ask). Personally I think Object-Oriented languages are a better fit for GUI programming. I think that as PHP moves into OOP realm in PHP 5 and especially PHP 6 you're going to see better tools for integrating with desktop environments.
That's just a guess, though.
By the way, whenever I look for tools I come across this one: WinBinder
Haven't tried it, though.
Because PHP is bad enough even for creating dynamic websites, its original and primary purpose. A few misguided souls work on projects such as PHP-GTK, but when there are dozens of nicer languages out there, why would anybody choose PHP to work in?
There's also PHP-Qt
Hmmmm... go figure: PHP-GTK. I guess PHP does have some library/designer support for desktop apps. I guess the second step would be to see how mature these tools are.
Currently the tools for creating GUI application with PHP are quite immature and the documentation is not as good as it could be. Also people might not know that you can do desktop apps with PHP, perhaps if the tools and documentation are ever included on php.net site desktop apps with PHP might become more popular.
Unlike many script languages PHP is quite a niche tool, web systems are where is excels, unlike Python or Ruby which can be adapted to different environments. Just look at the PHP standard library, almost everything there is targeted at web development.
AFAIK, PHP still lacks a true garbage collector -- this is different from, for example, Python, which does have a decent GC (although it is by far not as sophisticated as those of Java and .Net). Without a GC, writing any serious desktop application is just totally inconceivable.
As someone who has done extensive web app development in PHP, I wonder why anyone would want to make desktop apps in a language that I find frustrating in its limitations. I also wonder why there would be efforts to port the syntax of the language to desktop development when there are languages such as Java and C# that have similar-enough syntax (but without those irritating arrows for object accessing) and much more mature APIs that make sense on the desktop.
One of the good things about php is its platform independence, whichwould be dropped or faced problem when coming to write desktop applications. So you would be limited to ertain things (or gtk alike frameworks), then you would pick a particular platform, and then there will be a better choice.
I actually enjoy making php desktop apps, it's simple but no integrated in the sense that an Integrated Development Enviroment (IDE) works.
In php-gtk you make the GUI and the Code in two different places, this is good for someone who likes to separate the GUI and the Application(as every developer is expected to like), but it's bad for someone that likes to point&click.
Being said that, PHP isn't tailored to desktop applications and you'll suffer beyond the basic app.
I currently looking to run MonoDevelop as a better multi-plataform development suite for desktop apps (PHP still kick ass in the web).
I saw a presentation on scaling Facebook a couple years ago and one of the things they mentioned was that PHP has a number of memory leaks. They discovered it after writing an FTP daemon with it. You won't see this in every day web application settings because of the share nothing architecture in LAMP sites. Basically unless you use a byte code caching extension, everything from one request to another is thrown away. This includes the actual compilation of the script to byte code and any memory previously allocated during the last request. I imagine that this also makes writing desktop apps that are typically alive for a significant amount of time difficult.
I think eventually PHP will get there, Zend (the company behind PHP) unfortunately hasn't put any focus on delivering a PHP suited for desktop applications quote yet. Maybe this is something they will consider in the future.
On way to develop sudo-desktop PHP applications is to develop using Adobe AIR. Using Adobe AIR one can create Javascript/HTML/CSS front-ends for PHP-driven web applications. These front ends have more control and access to system resources on the desktop computer, such as file access, off-line storage and more. Combining AIR and PHP seems like a good fit, for cross-platform application that run on Mac OS X, Windows and Linux.
PHP-GTK is unfortunately not supported on Mac OS X, so your PHP apps there would be stuck on the Linux and Windows platforms only.
Maybe Zend will reconsider their web only stance with PHP in the future.
To deploy desktop apps using a prebundled webkit browser and PHP/Ruby/Python/Javascript/JQuery look at Appcelerator. It supports PHP based DOM manipulation, loads of APIs (inc geolocation) and cross platform deployment (Win, Mac, Linux, iPhone, Android). Must be seen to be believed.
for php desktop applications, i would just drop the old concept of a classic GUI desktop look'n'feel.
depending on the application, a whole lot can be achieved with a 'dynamical webpage' (php/html/js) running on browser at localhost, with a small local server and sqlite (or similar) database access...
everybody likes, and is accustomed to, the wonderful things that can currently be achieved on a browser using libraries like jquery or extjs.
further, code can be protected/encrypted with things like ioncube, as can also be encrypted the sqlite data.
the thing is, and i haven't found a sound solution, is how to bundle your application as a (say windows) binary, which automatically launches a local server and a browser for your desktop webapp to run in. anybody know any? please tell me.
further and deeper control of the browser would be desirable, but not attainable from what i know.
claims about php's syntax (like the ones concerning arrows) are just very shallow and shouldnt be considered... php is a great language, very easy going, fast learning curve/development, with very good frameworks, and it is the current diva of dynamical webpages...
PHP has terrible memory handling. Desktop applications can be open for hours/days, where a website can take less than 1 second to load. Memory leaks makes PHP Desktop application prohibitive.
PHP is not as good like Python or Ruby. PHP is a badly designed language. It needs total overhaul from ground zero to make it good.
Facebook is one who experienced this. They are forced to convert their php codebase to c/c++ using Hiphop.
I have been developing PHP desktop applications using Winbinder. its very easy and straight forwared. its pure php and way easier than PHP-GTK. but the problem with this tool. it has very tiny community and few developers. nobody is supporting it and the project might be died after a while.
its because its unknown tool and not that famous and people dont know what the hell is winbinder...
Reading all this feedback made me think, something that might be useful is a custom version of Webkit or Gecko's core HTML parser/browser to be packaged with a lightweight server (i.e. wapache: http://wapache.sourceforge.net/) and database (i.e. sqlLite or couchDB) with ports only opened only to local traffic to alleviate security concerns...
That would make building cross-platform PHP desktop applications alot more of a reality. Not only that but PHP developers more comfortable to the web paradigm wouldn't have to update their existing programming knowledge much (if at all) or drastically adjust their style.
For now, PHP-GTK is a good initiative but maybe they or another group could consider other alternatives than trying to bridge into every OS.