Convert Your PHP Web Application to a Native Desktop Application (Win, Linux, Mac)!

Fellow PHP Developers,

I have been programming in PHP for… god knows how long (at least 6 years). But besides PHP I also have experience in developing with JAVA, C++, little bit of Python, and also Ruby on Rails. Among them PHP just made more sense to me not only because of its popularity but because of its solid track record of being super reliable etc…

What bugged me though was I could not use PHP to create a decent Desktop Application. PHP-GTK, Titanium and other packagers were just horrible and most of them died out. Adobe AIR was promising but no PHP support… so no need to compliment that, lol.

Basically I wanted the following:

  • Something like PHPUnit
  • Something like Selenium for UI Testing
  • Something like CakePHP Framework
  • Something that allows me to create robust GUI for desktop
  • Something that is super easy to deploy
  • Something that works on Mac, Windows and Linux… period.

Sadly JAVA, Python and others were just not what I wanted. Java’s Swing Framework doesn’t excite me, wxPython is cool but doesn’t have the same cool factor Twitter’s Bootstrap provides. It lead me to finally decide that perhaps I just have to stick to something like XAMPP or WAMP… but XAMPP/WAMP are bloated and not that friendly for the average computer users. Besides starting the server and going to a URL like http://localhost/weird/ is clunky!

Ultimately… I decided to make my own solution and give it away for free. PHP has given me so much… I think it’s the least I can do for the community.

So… here’s my creation. It is called, Nightrain, the PHP Native Desktop Application packager.

Here’s what you can do with this:

  • Package any PHP Web Application as a Native Desktop Application (Just tested with Drupal and punBB… if they work, any PHP application should work!)
  • Use the precompiled PHP or use your own custom compiled PHP if required
  • Run your application on Mac, Windows and Linux
  • Download Nightrain, Copy your PHP app to /www, Do your setup, distribute!

You can download the packager here:

Also check the links on Tutorials, Troubleshooting and Gallery on the top for inspiration.

Nightrain is still in beta so you might run into issues. Just let me know and we will take it from there.

I hope this product will allow you to use your existing PHP skills to tackle the Desktop market as well! No need to learn JAVA or C++… just use good old PHP! :slight_smile:

Let me know how you feel about this. Good, bad… the ugly, just let me know :rofl:

Interesting. You say you’ve tested with drupal, so MySQL is included I guess (you only talk about PHP, HTML and CSS) ?

I must be missing something. I installed the QT library, but I keep getting a “Qt5WebkitsWidget.dll is missing” error?

Drupal actually does not require MySQL, Drupal also supports SQLite3. So, during the installation you can select SQLite3 driver and just follow the steps normally to install. Which Qt 5 did you install? (e.g. Qt 5.1.1 for Windows 32-bit (VS 2012), Qt 5.1.1 for Windows 64-bit (VS 2012)?

I think including MySQL database server will be overkill and defeat the purpose all together. Since the packager is intended for stand-alone applications (like Microsoft Word, Excel, Notepad), it makes more sense to use SQLite3 databases for such applications. Using MySQL for a application that will be used by a single user is a bit redundant. However, you can also instruct the user to install mysql server separately, compile the PHP in nightrain to have mysql drivers and update your PHP code to connect to a mysql server like you would do in a traditional PHP/MySQL app. But as you can see that’s a lot of work… and switching to SQLite3 for a regular PHP database driven app makes it lot easier for the end user.

Ok, I’ll have to take a look at SQLite3 as well then. If I can get nightrain to work that is :wink:

First I installed the QT Online Installer for Windows, but it gave some errors. Ignoring them I terminated the installation, but it didn’t work. Then I tried Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB). Installation went fine, but gave me the same error when running nightrain.

Right now I’ve tried installing Qt 5.1.1 for Windows 32-bit (VS 2012), installation went fine, but again: I keep getting a “Qt5WebkitsWidget.dll is missing” error when running nightrain?

I’m on W7 Home Premium 32-bit by the way.

I have not tested the project on “W7 Home Premium 32-bit” yet but I will try after I head home. From the looks of your situation… it is having some trouble finding the .dll files. Perhaps after the installation the .dll files were not registered properly by Windows. What you can do is… download DependencyWalker from and open nightrain.exe with DependencyWalker.

DependencyWalker will reveal to you exactly where Nightrain is looking for those Qt dll files. You can manually copy the /Qt5.1.1/5.1.1/<compiler>/lib/.dll files to that location or the ugliest solution of all… copy all the Qt.dll files to the same folder where nightrain.exe is located.

Not sure out of all the OS why Windows acts so strange :injured:

I’ve installed Dependency Walker, and it told me that nightrain is looking for the dll’s in the nightrain folder. So I copied and pasted the QT dll’s. But now it’s missing other dll’s (MSVCP110, MSVCR110, and a bunch of API-MS-WIN-CORE dll’s) and it’s looking for those in the nightrain folder as well?

WOW… this is interesting. I hope something in your computer did not screw up the environmental variables. However, I got a strong feeling you may not have the Visual C++ Redistributable packages installed. Perhaps the home edition do not include them by default. Go to and download VC++ Redistributable Packages (VC++ 11.0). Let me know how that goes.

Thank you so much for debugging this. I really appreciate it! :blush:

Ok that seems to have done the trick. I now get an error when the script tries to connect to MySQL, but that’s normal :slight_smile:

Thank you so much for debugging this. I really appreciate it! :blush:

No need to thank me, it’s in my own interest if I want to start using your product :slight_smile:

I’ll be back if I have other questions/problems :wink:

No more questions… looks like Nightrain is working well for you :P. I just released Version 2.0. It is a complete rewrite and has couple of new features and bug fixes from the initial release. Feel free to try it out!

No time to work with it :lol:
I will download version two, and I hope to be able to work with it soon.

am really happy to here this news, i searched on google for application which can convert php to windows apps and i end up getting " ExeOutup for PHP" its really good but bad news is its not for free, i started to learning JAVA but its so hard for me, Just now i’ve started using your solution but unfortunately i get some errors “Qt5WebKitWidgets.dll is missing from your computer”. please help me with this problem, or some one tell me the best way i can do.

The same error I had. Read all posts in this thread and you’ll find the solution :slight_smile:

yeah, i went through all steps, but when i open nightrain on Dependency Walker i get this error “Error: At least one required implicit or forwarded dependency was not found.” And some other .dll like MSVCP110.DLL, QT5WEBKITWIDGETS.DLL. i have installed Microsoft Visual C++ 2012 Redistributable, but still i get those errors. of course i did not use Wordpress, Joomla or Drupal on my project, i just used CSS5,HTML5 and PHP!! am sorry if its makes no sense but that is what i need for now and i’ve to convert those PHP pages to windows form.

I see. In that case, let’s hope @roosevelt; knows how to solve your problems

I also got the missing dll errors. I went to,

and copied all dll’s to the nighttrain folder and it launches.

nighttrain is here (on my system).

When I launch nightrain.exe it shows phpinfo(), changed the index.php to a “hello world” .
So it is working, now to find a use for it LOL.

Hi Guys,

Sorry for the delay. I forgot to turn on e-mail notification for this thread. @Mamouz It seems like you are having the same issues as guido2004. Installing the Qt-5 libraries and the Run-times for Visual Studio should take care of the problem.

But @lorenw I am not so sure why Windows still cannot find the Qt libraries even though Qt-5 is already installed on your computer. In the next update I will offer two solutions. One with all the required libraries embedded so the application is completely portable and another without the libraries. @lorenw You can start by cloning a popular desktop app. If experience serves me right… it is much faster to develop a web application with HTML/PHP/CSS/Javascript than a Java or C++ based GUI app!

BTW I also created a Trouble Shooting page on the main website. Updating it regularly with some of the common issues.

@roosevelt, I was confused why it couldn’t find the dll’s.
I used dependency walker as suggested and it said that nighttrain was looking in C:\web
ighttrain\ for the dll’s, so naturally I dumped them in there, it works perfectly but it looks a bit cluttered.
This is a brilliant application, my comment “now to find a use for it LOL”, was just that I WILL find several uses for it.
I can’t remember what it was but came across a situation in the past that this would have worked perfectly for.
I really am impressed.

Next thing to try is an sql connection.

If you manage to do that please let me know how. I still haven’t found the time to work with it but I’m very interested.

There is a similar project called “PHP Desktop”, it is open source. Recently a version with Chrome embedded was relased, see the project site:

PHP Desktop with Chrome embedded doesn’t have any dependencies like Nighttrain (Qt, MSVC runtime), the downloaded binary zip is portable and works out of the box.