Trying to run Joomla 3.0 on Phalanger - several errors

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

Trying to run Joomla 3.0 on Phalanger - several errors

Postby highcore » December 23rd, 2014, 3:22 am

Hi.

We're evaluating Phalanger and we're interested specifically in running Joomla on top of it, and deploy to Linux servers via Mono.

As a proof of concept, I performed these steps:

  • 1 - installed Phalanger & Visual Studio Tools (from Tools -> Extension and Updates menu option in VS)


  • 2 - Created a new Phalanger project (using File -> New Project -> Phalanger -> Empty Web Application (Standard))


  • 3 - Added all files from a vanilla Joomla 3.0 site (using Solution Explorer -> Include In Project menu option)


  • 4 - attempted to build, and got 2 compile errors about undeclared class members (which are to be expected since PHP is untyped and Phalanger is not), this is not a problem at all and I managed to fix it perfectly.


  • 5 - After clearing out the above, I managed to successfully build the project, but trying to run it throws a PhpException in the very first line of PHP code found in Joomla's index.php file:

    Image


  • 6 - After some searching I came by http://support.devsense.com/viewtopic.php?f=3&t=1054&p=4871&hilit=call+to+undefined+function#p4871 and added the following to the project's web.config file:

    Code: Select all
    <configSections>
        <section name="phpNet" type="PHP.Core.ConfigurationSectionHandler, PhpNetCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71" />
      </configSections>

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="Phalanger"/>
        </assemblyBinding>
      </runtime>

      <phpNet>
        <classLibrary>
          <add assembly="PhpNetClassLibrary, Version=4.0.0.0, Culture=neutral, PublicKeyToken=4af37afe3cde05fb" section="bcl" />
          <add assembly="PhpNetXmlDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03" section="dom"/>
        </classLibrary>
      </phpNet>

  • 7 - After that, I get several compilation errors about invalid argument counts in several PHP function calls:

    Image

  • These are the affected lines of code:

    Code: Select all
    //stream.php - Line 1024
    $retval = @stream_context_set_option($this->fh, $this->contextOptions);

    //stream.php - Line 1190:
    $res = @copy($src, $dest, $context);

    //stream.php - Line 1195:
    $res = @copy($src, $dest, $this->context);

    //stream.php - Line 1244:
    $res = @rename($src, $dest, $context);

    //stream.php - Line 1249:
    $res = @rename($src, $dest, $this->context);

    //input.php - Line 691:
    $trans_tbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'ISO-8859-1');



From the official PHP documentation I can see that these function calls seem to be correct, since many of the parameters are optional:

http://php.net/manual/en/function.strea ... create.php
http://php.net/manual/en/function.copy.php
http://php.net/manual/en/function.rename.php

for example, copy() and rename() both accept an optional $resource parameter according to PHP documentation, but Phalanger's Intellisense support doesn't show that extra parameter, and it fails to build.

Question 1: Can you help me overcome these issues? we're very interested in integrating .Net and Joomla and it's very likely that we will acquire licenses for the Tools if we manage to get this integration running.

Question 2: Is Mono supported? We also need to host on Linux servers, therefore it's important for us that Mono is supported. We'd be using Mono 3.8 (latest one).

Question 3: Are there any plans to port Phalanger to .Net Core? is this even feasible? We need to plan for the long run and this information is also important in making a decision.

Question 4: Is there any way to set the .Net Framework version and the PHP language version in a Phalanger project? We've had issues with our existing Joomla sites if we changed PHP to version 5.4, so we'd like to stick to 5.3 for the moment if possible. Also, support for .Net 4.5 or greater is highly desired, since we have a lot of existing code in the form of Portable Class Libraries targeting .Net 4.5

Thanks in advance
highcore
 
Posts: 9
Joined: December 23rd, 2014, 2:14 am

Re: Trying to run Joomla 3.0 on Phalanger - several errors

Postby Jakub Misek » December 28th, 2014, 2:03 am

Hi,

I'm glad you are working on Joomla on top of Phalanger.

First of all you have to add all extensions you'll need to your web.config (as you did with phpnetclasslibrary).

Performing the first compilation will reveal first compatibility issues. Missing mandatory arguments may mean a bug in Joomla or a missing overload in Phalanger library.

Mono is supported, using mod_mono extension for apache.

What do you mean by porting Phalanger to .NET Core ?

Phalanger compiles PHP into .NET Framework of the same version as your Phalanger is built on (currently 4.0). It cannot target different versions of PHP, it is (smth.like) compatible with the only one. The intention is to behave like the latest PHP version.
Jakub Misek │ DEVSENSE s.r.o. │ Email: jakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2061
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Trying to run Joomla 3.0 on Phalanger - several errors

Postby highcore » December 30th, 2014, 5:34 am

Jakub Misek wrote:First of all you have to add all extensions you'll need to your web.config (as you did with phpnetclasslibrary).


I did this. I grabbed the example web.config file from here:

http://wiki.php-compiler.net/Configuration/3.0

And uncommented all <add assembly .../> lines under "Bundled managed extensions", I did not add the ones that say "native" because from what I can see these are not supported on Linux, and, while I'm currently developing on Windows, my intention is to deploy to Linux in the future.

Performing the first compilation will reveal first compatibility issues. Missing mandatory arguments may mean a bug in Joomla or a missing overload in Phalanger library.


Apparently it's a missing overload or optional argument in Phalanger. The PHP documentation has such parameter, but Phalanger does not.

If you point me in the right direction, I can implement the missing parts myself and do a pull request for you to include it on Phalanger officially =) I'm willing to contribute to this project.

What do you mean by porting Phalanger to .NET Core ?


Since PHP is mostly a server targeted platform used for Web applications, and since Microsoft will provide official support for Linux and OSX platforms with .Net Core (http://blogs.msdn.com/b/dotnet/archive/ ... -core.aspx), maybe it makes a lot of sense to think about the possibility to make Phalanger target .Net Core, instead of the full .Net Framework / Mono. Also, the new .Net Web stack is totally decoupled from IIS and System.Web, which might be an advantage too.

Phalanger compiles PHP into .NET Framework of the same version as your Phalanger is built on (currently 4.0). It cannot target different versions of PHP, it is (smth.like) compatible with the only one. The intention is to behave like the latest PHP version.


I understand. Any plans to upgrade to .Net 4.5 at least? My problem with 4.0 is that much of my existing code is inside Portable Class Libraries and these cannot target 4.0 (at least not without a lot of limitations), I would have to recompile a lot of code if I needed to reuse it from PHP web applications.
With this too, I'm willing to contribute. If you guide me thru the steps required to setup everything. I can attempt to compile Phalanger and make it run under .Net 4.5, then I will PR and you can keep both versions around if you want =)
highcore
 
Posts: 9
Joined: December 23rd, 2014, 2:14 am


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 4 guests

User Control Panel

Login

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 62 on January 7th, 2012, 10:54 pm

Users browsing this forum: No registered users and 4 guests
Phalanger