开发者

Running a PHP application in a desktop environment

开发者 https://www.devze.com 2022-12-15 06:56 出处:网络
I h开发者_如何转开发ave been pondering about this for a few days, and I\'m surprised this hasn\'t been done yet or isn\'t very popular.

I h开发者_如何转开发ave been pondering about this for a few days, and I'm surprised this hasn't been done yet or isn't very popular.

What I would like to see was a way to run a PHP application inside a desktop application. For example, the application would need its own mini webserver that doesn't handle requests, but allows PHP to be run.

Sometimes I have been set with tasks that clients demand coded in C# or .NET, and I think to myself 'I could have this done so much quicker if I could use PHP'.

Does anyone have any information on this subject? And FYI I do know PHP is meant to be a web programming language and is not meant to be run in a desktop application, but I'm intrigued :)


PHP-GTK hasn't had a new version since 2008, but it may suit your needs.


http://gtk.php.net/ is exactly what you want. You will be using an old GTK version, at least until a new php-gtk version is released (which is expected soon, according to the main page), but even that shouldn't be a big problem.

Also, see http://news.php.net/php.gtk.dev, it shows there is still activity on the project.


If you mean console (command-line) applications then by all means you can do that. I do it all the time, both on Windows and Linux. Obviously you will not have web-server related variables ($_GET and so on) but other than that you have full functionality of PHP.

See this for details.

PHP installations come with two executables, one for CGI (common gateway interface) and one for CLI (command line interface). Just set up PHP on your machine and use the correct php.exe.

If you mean applications with windows then, like others say, there are frameworks for this, but I doubt this is a good idea.


Well if you write a simple shell in .NET, you can drag a web browser object into the desktop app and simply show a webpage inside there, without the browser controls (back, home, etc).

This is a bit hackish, if you want a desktop app, code a desktop app, you'd be surprised how easy it is in C#.NET. And obviously the PHP needs to run somewhere, either on an external website or a local web server (ex: XAMP)


I've done a couple of applications for a customer using miniPHP Studio for exactly the same reasons. Both me and the customer were happy about the result. Might take some time to get used to it, but it has a kind of a debugger built into the IDE and, being based on Winbinder, you can use its forum to pick up more code samples.

Stuff I definitely found out works well with it: PDO, MySQL, SQLite, cURL, mbsting, mhash, mcrypt, bz2, ADODb (after modifications), running external programs. Stuff I never managed to make behave: FreePDF, having the input fields accept Unicode characters.

For the future (read: as soon as I find some free time) I'm gonna take a look at Titanium. This one definitely looks as being actively developed and on a path upwards.


PHP Nightrain is a packager written in Python for the PHP Programming Language. Using this tool you can convert your PHP/HTML/CSS/Javascript application to a Native Desktop Application. Currently, PHP Nightrain supports the Windows, Mac (OS X) and the Linux operating systems.

Features:

  • PHP 5 Pre-compiled
  • Option to use your own PHP
  • GUI rendering your PHP/HTML Web Application
  • Set custom width and height
  • Start application Maximized if required
  • Start application Fullscreen if required
  • Window Title changes as the value of the title tag changes
  • executable for Windows
  • executable for Mac
  • .app file for Mac
  • executable for Linux

https://github.com/naetech/nightrain

http://www.naetech.com/php-nightrain

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号