Peachpie Compiler – Frequently Asked Questions

We have received a number of questions across multiple channels so far, and we felt that it would perhaps be beneficial to compile a list of some of the most frequently asked questions along with their answers.

PHP sucks, why port this horrendous language to .NET?

Contrary to what this question implies, the compiled PHP will not destroy the existing .NET, nor will it decrease the quality of the target application. In fact, the goal of Peachpie is to take the existing PHP code and transform it so that it can work on the .NET runtime. Many of the language’s problems will be fixed through this process. The outcome of this will be that the current PHP apps will be moved to new, modern platforms.

Why are all the benchmarks comparing Phalanger with PHP 5.4?

The benchmarks we showed were produced in 2012 using the contemporary versions of PHP and the .NET CLR. Phalanger currently does not support versions newer than PHP 5.4.

Will Peachpie support PHP 7?

Yes, it will. But not quite yet. Please refer to our roadmap below and our status updates in the ReadMe file on GitHub to see which features and aspects are already supported.

How will I know if Peachpie will work for big projects? Has Phalanger ever been used?

Phalanger has been used in several large projects, not the least of which is WordPress (WP.NET). Please refer to the Phalanger list of reference projects to see some of the ways in which it has been used.

Because Peachpie is heavily based on Phalanger, which is tested and proven to work, Peachpie will definitely work even for large and complex projects. However, we are still in the conceptual phase and not ready to deploy any projects with Peachpie yet.

Why would we want to lose the dynamic nature of PHP by compiling it to .NET?

The great thing about Peachpie is that it allows you to leverage the dynamic abilities of PHP, while benefitting from the specific advantages of each of the two languages/frameworks. Therefore, you are not losing out on any of the advantages of PHP, such as its dynamic nature.

Why not compile the other way around, from .NET to PHP? I’d like to call C# from PHP.

These two things are not equivalent. Compiling from .NET to PHP is technically extremely complex, if not nearly impossible. It will not achieve interoperability and you would actually lose out on some advantages of .NET in the process, while the end result would likely be extremely slow.

Calling C# from PHP, however, is possible and one of the greater advantages of Peachpie. The C# and PHP code will be both-way interoperable and you can take advantage of some of the more interesting libraries in each language.

Will Peachpie work on Linux?

Yes, since Peachpie is built on top of Roslyn and produces portable class libraries compatible with Mono and the .NET Core.

Will Peachpie work on mobile devices or tablets?

Yes, since Mono and Xamarin are well documented to run on Windows, Linux, Android, Windows Phone, Windows 10 IoT Core, iOS or OSX.

Will Peachpie support PDO?

It will. Phalanger does already, and it is on the roadmap for Peachpie, too.

Can Peachpie do PHP eval?

No, not in the first development phases. This is planned in the future, but it will certainly take a while before Peachpie will be able to do PHP eval.

By compiling to .NET, will Peachpie also offer the multithreading support through NET?

Indeed, Peachpie-powered projects will also have the multithreading support through .NET.

Will Peachpie support the standard PHP libraries?

Yes, parts of this functionality will be taken from the already working Phalanger, and other missing ones will be added.

Does Peachpie allow for PHP to run on the Raspberry Pi?

As crazy as this sounds, it does indeed. In fact, as you can see from our roadmap below, we are relatively close to being able to use Peachpie on Windows 10 IoT Core – and therefore also on Raspberry Pi. Therefore, you will be able to program apps for Windows IoT Core in PHP in the not too distant future thanks to Peachpie.

What state is Peachpie currently in? Can it already be used?

To answer the second part initially: no, it cannot be used as of yet. At the time of this post, Peachpie can be executed, and is able to perform a relatively wide array of mathematical functions, such as algebraic operations, trigonometric functions, Pi calculations, etc. It can also call C# already within a PHP project. To make the concept a little more transparent, here is a high-level look at our roadmap with some of the use cases as end points:

Peachpie roadmap

Will Peachpie run WordPress?

Not only will it compile WordPress (where the goal is to improve its performance), but it also allows for .NET to be extended by allowing for plugins for WP to be written in C#.

Why Peachpie and not HHVM?

The two are not interchangeable or equivalent. HHVM compiles PHP down to the ASM (Edit: HHVM does not compile to C, as we mistakenly assumed), while Peachpie targets .NET. Therefore, it depends on the individual needs that you want addressed.

Posted on April 6, 2016, in category Information, tags: , , , , , , ,