PHP offers a lot of various extensions which add additional library functions, classes, constants and other constructs. Common extensions include for example php_mysql and php_iconv. Since extensions are implemented in C language, the performance is great. It also allows programmers to use other native libraries that are not available in PHP. However there is one big disadvantage; writing such extensions is not easy. C code is harder to maintain, it requires learning lower-level language and it is easier to make mistakes that lead to program failures that are hard to handle.
Category Archives: Blog
WordPress on .NET with SQL Server is Possimpible using Phalanger 3.0
In a recent scenario I wanted to run WordPress as a subdirectory of a .NET application. I also wanted to avoid installing PHP and MySql on the Windows server. Impossible? Apparently not! (I’ll get to the word Possimpible a bit later).
I already have IIS and SQL Server setup, so I want to utilize those with WordPress. To do this I installed a pre-compiled version of WordPress, using Phalanger, as well as a simple WordPress plugin to avoid having to install MySql. Here is what I did…
Continue reading
Phalanger riding Mono
Phalanger is a complete reimplementation of PHP, written in the C# language. It was always being developed with the Mono platform in mind. This means you can compile and run PHP application on Linux web servers using Mono. Since Phalanger 3.0, this become more official, periodically tested and maintained. Continue reading
.NET interoperability overview of Phalanger 3.0
The main goal of Phalanger is to provide fast and easy means for PHP and .NET languages to interoperate with each other. When using Phalanger, PHP becomes a .NET language, but it’s still a dynamic language. That means that, in order to communicate with strongly typed languages as C#, we need more sofisticated architecture. This comes with DLR (Dynamic Language Runtime) and dynamic keyword in C#. Continue reading
Passing .NET delegates into PHP
Phalanger is the only solution allowing to seamlessly interoperate between PHP and .NET world. It allows to use e.g. .NET generics, namespaces, properties, method overloads, global variables, constants and .NET delegates in both worlds. In this post I will show how to pass delegates from C# into PHP, and how to use them in PHP.
Using C# in App_Code from PHP scripts
Phalanger 3.0 brings several cool and useful features, making interoperability between C# and PHP even easier. In this post, I will show one of them. Continue reading
PHP, Global.asax and Output caching
Global.asax file gives web developers great posibilities of handling the life-cycle of their web app. It is a common practice to take advantage of this file in ASP.NET applications. Now you can make use of it in a PHP web application too.
Phalanger 3.0
Today we have released sources of Phalanger 3.0 – the PHP compiler for .NET Framework. It represents a big step for PHP compatibility, .NET interoperability and overall performance. Continue reading
“dynamic” keyword and PHP objects
We’ve already demonstrated, how to use PHP scripts from within a .NET application using Phalanger. For reference you can take a look at PHP as a scripting language for C# article or Standard mode interoperability tutorial. In this way we can take an existing PHP web or a library, load them into C# context and reuse their functions, classes, constants or global variables. In addition we can even define new functions and classes in C# and inject them into PHP, so the code in PHP seamlessly uses these declarations as they would be declared in PHP too.
EDIT: Phalanger 3.0 removes all the limitations mentioned below. Continue reading
Phalanger takes advantage of DLR
We are happy to announce that Phalanger 2.1 for .NET 4 (August 2011), our PHP language compiler, takes advantage of Dynamic Language Runtime (DLR) [1] which is present in .NET 4.0 Framework and Mono. Continue reading