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.
Author Archives: Jakub Míšek
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
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.
“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
PHP as a scripting language for C#
When creating .NET applications (including desktop and web applications), it may be useful to allow extending the application using some scripting language. The users of the application can write simple scripts to configure the application, modify how data is presented or write simple add-ins. In this article, we look how to use PHP as a scripting language. Continue reading
Installation-Free Phalanger web
A few people asked how to run their web site on top of Phalanger without a need of installing Phalanger. This seems to be useful idea, since you may not be allowed to (or you just don’t want to) install any additional software on a target machine. Since Phalanger works like standard ASP.NET request handler and uses a little of standard .NET configurations, it is possible. And the new version of Phalanger (June 2011) makes it even easier to configure. Continue reading
Improved WordPress performance with Phalanger
Update: Latest benchmarks are depicted on Benchmarks page.
One of the reasons why you may be interested in using Phalanger is that you need to run your PHP applications faster. Phalanger is a PHP language compiler for .NET. It is almost fully compatible with PHP, and it also adds several useful extensions. It makes it easy to integrate PHP applications with .NET or ASP.NET and it adds better compile time checking, but we’ll write about these in some other article.
Phalanger + WordPress
As an established open-source community project, Phalanger already has a discussion forum and an issue tracker. Today, we’re starting a new Wiki page for Phalanger and also this blog. Although we’re actively working on Phalanger, we didn’t have any way to easily share news and information about the development of Phalanger with the community. We’re hoping to change it with this blog. Continue reading