Phalanger with PHP-GTK

Discussion about the open-source Phalanger [?] project.

Phalanger with PHP-GTK

Postby ardee00 » May 25th, 2013, 3:58 pm

Greetings. I have a legacy PC desktop application written in PHP and executed under PHP-GTK. I would love to bring it into Visual Studio via Phalanger, but everything I have tried has failed (many hours wasted).

Can anybody offer advice on this?

Details: Visual Using Studio 12 on 64-bit Windows 7 system. Latest Phalanger download (3.xxx). The PHP interpreter setting points to the php.exe that we normally use, which is in a folder called php-gtk. XDebug is installed.

If I try to load one of Phalanger's sample PHP projects, I get this error:

Code: Select all
There is a missing project subtype.
Subtype: '{7FB7D0AD-ABC6-4BF8-BB4D-B2C68B00F984}' is unsupported by this installation.


I couldn't find anything about that via Google or Bing.

I can create a new PHP project and build it successfully, but when I try to run it I get this error:

Code: Select all
PHP could not be installed. Ensure PHP is configured in Options / PHP Tools / Interpreters.


PHP is configured there. That config dialog box acknowledges the version of PHP (5.2.4), the path to the php.exe file, the location of the php.ini file, and the fact that XDebug is installed. No more detail about the problem is provided, unfortunately.

I am stuck and would be very grateful your help. Thanks!

Roy
ardee00
 
Posts: 2
Joined: May 25th, 2013, 3:36 pm

Re: Phalanger with PHP-GTK

Postby Jakub Misek » May 25th, 2013, 8:41 pm

Hi,

Great you are trying Phalanger.

However Phalanger does not support GTK, windows applications are built thru standard WinForm applications (Phalanger WinForm project).

Your settings to PHP Interpreter and Xdebug affects PHP projects, not Phalanger projects. Here you should decide whether you want Phalanger (which means you would like to run PHP code on .NET Framework) or you want just to develop under Visual Studio (so you can keep running under PHP-GTK).

If you want to migrate to .NET platform, Phalanger is the option. You can use Phalanger Tools plugin for Visual Studio, and you can create new Phalanger WinForm project. (you don't need PHP, php.ini, xdebug, ...)

In case you just like Visual Studio, and you don't want to migrate PHP-GTK project to .NET; keep using PHP and PHP Tools plugin for Visual Studio. (http://visualstudiogallery.msdn.microso ... 5f50c95fb5)

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger with PHP-GTK

Postby ardee00 » May 25th, 2013, 10:36 pm

Thanks for your response! I did install that plug-in. There is a huge amount of legacy code, including GDK/Glade stuff, that there's no way I could rewrite it, even given a year (I have maybe a week). When I read about Phalanger, it said that there were 2 different ways to use it: create a new .NET project and use Phalanger "pure", or use the "legacy" feature. The documentation I read used the following phrase for the legacy stuff:

...generates Console or Windows Forms application that is written using the legacy PHP mode in which you use global code, includes and other PHP features.


I guess I was overly optimistic in interpreting that to mean that I could just bring all that old stuff over and tweak it to get it working within .NET. I guess that option isn't possible at all. :cry:

After I gave up trying that, I investigated the DOTNET class in PHP and it looks promising. I'm hoping I can find a way to better integrate the old (huge) PHP application we have with the new .NET applications I wrote. My plan is to combine all those .NET apps into one big DLL and instantiate the various form objects as needed from the PHP code. I hope that approach will work!

Thanks so much Jakub. :)
ardee00
 
Posts: 2
Joined: May 25th, 2013, 3:36 pm

Re: Phalanger with PHP-GTK

Postby Jakub Misek » May 27th, 2013, 9:51 pm

Yes, sadly GTK is not implemented in Phalanger; since it has WinForms.

DOTNET extension allows you to call .NET methods from PHP (but not the other way). Still it is an option for legacy PHP developers. I'm not sure about the performance and the state of the project, but you can achieve what you need.

At least, you can get use of PHP Tools for Visual Studio for your development.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger with PHP-GTK

Postby weirdan » June 4th, 2013, 1:20 am

Actually I was able to successfully compile and run a PHP script with GtkSharp. While it probably won't be of much help to the topic starter, I feel it must be noted that using GTK from Phalanger is certainly possible (just not the way it's used in PHP-GTK).

The following is the demo script I used:
Code: Select all
<?php
use Gtk;

class Program
{
    public static function Main()
    {
        Gtk\Application::Init();
        $win = new Gtk\Window("Hello");
        $win->Show();
        Gtk\Application::Run();
    }
}


Compile parameters:
Code: Select all
mono --debug Source/PhpNetCompiler/bin/Debug/phpc.exe /pure+ /reference:/home/weirdan/src/Phalanger/bin/PhpNetCore.dll /reference:/home/weirdan/src/Phalanger/bin/PhpNetClassLibrary.dll /reference:/usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll /encoding:UTF-8 q.php
weirdan
 
Posts: 17
Joined: June 4th, 2013, 1:11 am

Re: Phalanger with PHP-GTK

Postby Jakub Misek » June 4th, 2013, 9:18 am

weirdan wrote:Actually I was able to successfully compile and run a PHP script with GtkSharp.
Great note, Thanks! GtkSharp is the option.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 124 on September 25th, 2020, 6:57 am

Users browsing this forum: No registered users and 1 guest