I want my console program simply be run using Phalanger. I did not use IIS or .net in any way. Is it possible to use Phalanger in the same way that we use php.exe -f hello.php
? How to compile and run following script using Phalanger.
<?php
echo "Hello World from Phalanger!";
Phalanger works as a compiler and runtime for PHP.
The easiest way is to install Phalanger Tools for Visual Studio, which allows you to create, build and debug console application.
Anyway, without Visual Studio; first you have to compile the code
phpc hello.php /out:hello.exe
Optionally, if you have more files in your project, you should list them all, and specify the entering script file
phpc.exe /target.exe /entrypoint:hello.php /root:. /recurse:true /out:hello.exe
Which compiles everything (*.php) in current directory and subdirectories, and specifies "hello.php
" to be the entering script file.
This creates an executable file "hello.exe
".
After you succeed with this basic example, you may be interested in using some PHP extensions (like GD2). This can be done by adding following parameter,
"/r:PhpNetGd2, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2771987119c16a03
which is the full name of the library containing GD2 functionality.